Matt Lang

I’m having a really hard time trying to get versioning on files in SS4.

The documentation isn’t right, these 2 pages claim different things about how to set keep_archived_assets (on File or FlysystemAssetStore) but the actual config var seems to be on AssetControlExtension, and I can’t seem to get it to keep replaced files with any of them set. I’m not even sure if it’s the setting I need. https://docs.silverstripe.org/en/4/developer_guides/files/file_management/ https://docs.silverstripe.org/en/4/developer_guides/files/file_storage/

In SS3 we had a History tab on files which let us download all previous versions, is there a way to achieve this in SS4? Ideally stable SS4.3, haven’t tried the latest/unstable SS4.4

firesphere

File versioning, as far as I'm aware, does not yet let you view the history

nightjarnz

There's a global archive section that does this.

firesphere

Right. /me runs apt-get update;apt-get upgrade FileVersioning

Matt Lang

Okay I can show history again using

  1. SilverStripe\AssetAdmin\Forms\FileFormFactory:
  2. show_history: true

But I still can’t work out how to get files to actually keep previous versions, currently the earlier versions in the history tab just send me to the latest copy on disk and the older versions have been deleted.

👍 (1)
nightjarnz

what version? Have you checked to see if there are open issues on GitHub? Would you like to log an issue on GitHub if not? Have you tried upgrading to 4.4? Did you know the upgrading tool (silverstripe/upgrader) can help upgrade between minor versions, not only just 3 -> 4?

nightjarnz

althoug 4.4 will be 4.4.x-dev at current I believe (4.4.0 yet unreleased)

Matt Lang

My issue is with a lack of documentation, I’m not sure what I need to do to make SS not delete the old versions of files when a new replacement is uploaded (if it’s still possible). I haven’t tried 4.4 as I’d rather use “stable” in production.

nightjarnz

4.4 is due in the next few weeks, and includes all the work on files that might see your problem disappear :)

nightjarnz

In short, I'm not sure either sorry, but perhaps you could try the new version, I know the team that did the work are actively looking for "real world" test cases and feedback at the moment :)

nightjarnz

It would be ideal if a partner could be a part of that too :) Even if the feedback is "omg problems gone, yay!"

nightjarnz

Although I don't like pinging him directly, I'm sure @max could provide a little guidance if you're interested @Matt Lang :)

max

@nightjarnz (I'm fine with being ping directly on Slack, when people feel I'm the most competent person to answer a question )

nightjarnz

Yay :D Well, there are queries about file migration, and I am trying to encourage Matt here to give 4.4 a "live" (read: real world data set, not in production) test for you.

max

To keep your files archived add something like this in your YML config.

  1. SilverStripe\Assets\AssetControlExtension:
  2. keep_archived_assets: true
max

This extension is applied to DataObject ... by setting it on AssetControlExtension, you're setting on File as well.

max

In theory, setting it directly on File should work as well, but I haven't tried it.

max

If you wanted to really make your life complicated, you could enable archive on Image, but disabled it on File.

max

About viewing archived Files, to my knowledge we don't provide an interface for that. However, if you are looking at an old version of SiteTree object that reference a prior version of a File, that record should be considered a dependent record, so it should be showing there and be restored along with the page.

That is, if the File is inserted through a WYSIWYG.

max

If your File is reference through a has_one/has_many relationship, you might have to define an ownership relation.

max

I'm not 100% about those last two points ... I may be making things up.


Show less replies
Matt Lang

Elsewhere I’ve gotten around this with Versioned::get_by_stage('MyPage', Versioned::LIVE)->byID($id)->Link() But because it’s a many_many relation I don’t easily have the ID of the related model. It’d be nice if there were something available like $myModel->MyRelatedPages()->first()->latestPublishedVersion()->Link()

Matt Lang

Is there a way I can make sure I get a link without ?stage=stage? I’m using $myModel->MyRelatedPages()->first()->Link(). What I want is just the normal link to the latest published version of that page, not with stage=stage appended.

Matt Lang

Is there a way of applying an extension to a class just for a particular phpunit test?

I’ve got a TaxonomyTermUrlExtensionTest as part of the Taxonomy module, and I need to apply this extension to be able to test it:

  1. SilverStripe\Taxonomy\TaxonomyTerm:
  2. extensions:
  3. - SilverStripe\Taxonomy\Extensions\TaxonomyTermUrlExtension

I’ve tried adding that as a fixture .yml but it doesn’t seem to apply it. I’ve tried adding this in the setUpBeforeClass

  1. Extensible::add_extension(TaxonomyTerm::class, TaxonomyTermUrlExtension::class);

Which seems to apply the extension but doesn’t re-build meaning it doesn’t add the db column before the test runs (i.e. the mysql error here https://travis-ci.org/silverstripe/silverstripe-taxonomy/jobs/531541126)

I don’t want to add the extension using the module’s _config/*.yml or else it will always add it for everyone (or at a minimum for all tests), whereas it should be optional.

Any other ideas?

Matt Lang

Thanks. How does Platform do system logging? CWP uses greylog

Matt Lang

What are the differences between CWP and SilverStripe Platform? I understand the hosting difference (Rivera/NZ vs AWS), are there other differences in the services included?

Matt Lang

Ahhh, worked it out, needs to be

  1. After: services-addon-name/routes#serviceroutes
Matt Lang

Is is possible to re-route a director rule? e.g. if some addon has a routes.yml like this

  1. ---
  2. Name: serviceroutes
  3. After: framework/routes#coreroutes
  4. ---
  5. Director:
  6. rules:
  7. '//services/$Action/$ID!' : 'ServicePage_Controller'

is it possible to direct that url to your own controller with something like this?

  1. ---
  2. Name: specialserviceroutes
  3. After: 'serviceroutes'
  4. ---
  5. Director:
  6. rules:
  7. '//services/$Action/$ID!' : 'SpecialServicePage_Controller'

Can’t seem to get it to ever use my controller

Matt Lang

Wouldn’t have to be super timely, regular email times would be fine. Also looking at other options but will note that fact for the decision makers.

Matt Lang

I’m just looking at options for a possible alert service, which could need to send thousands (or possibly up to 10s of thousands) of unique emails per day to thousands of registered users.