Open Oliver996 opened 4 months ago
Hi - it looks like the only hooks in the SiteTreePublishingEngine are related to publishing, so yes, I think this module currently doesn't work with non-versioned objects.
For your case, you should be able to work around it by replicating the onBefore/onAfter changes, and applying them to write rather than publish (and delete rather than unpublish).
I think there's a potential PR where the onBefore/onAfter methods are called with an "if this thing is not versioned" check? Potentially worth experimenting with
Module version(s) affected
^6.2
Description
I did add everything like documented https://github.com/silverstripe/silverstripe-staticpublishqueue/blob/6/docs/en/basic_configuration.md#engines to the dataobject to trigger republish of the cache. When the dataobject is versioned the objectsToUpdate is triggered when I unpublish or/and archive the dataobject. But in a dataobject that is not versioned it only triggers on save, but not on delete. I could not get objectsToUpdate to trigger on delete. Is this a bug, not meant to work with not versioned dataobject or is there some documentation missing for not versioned dataobject? I did test it on my silverstripe 5.2 and also on a clean silverstripe 5.2 with only the staticpublishqueue both had the same problem. It also would be nice to add that you need the canPublish function for versioned dataobject in the documentation.
How to reproduce
Clean 5.2 Silverstripe with staticpublishqueue then added dataobject like https://github.com/silverstripe/silverstripe-staticpublishqueue/blob/6/docs/en/basic_configuration.md#engines
Test.php with objectsToUpdate and objectsToDelete (both simply for testing)
yml
After saving, it creates both jobs, but after delete it creates no jobs for update/delete cache.
When adding versioned to the dataobject (add to Test class)
Then it works with saving, publishing, unpublishing and archiving. It always creates both jobs
Possible Solution
No response
Additional Context
No response
Validations
silverstripe/installer
(with any code examples you've provided)