Reputation: 179
I want to set pages to unpublish automatically at a set date on silverstripe 3.
I have seen multiple solutions for this online, mostly with the use of certain modules however none of these are compatible with silverstripe 3 and a lot of the modules say they are now abandoned, if not I get the following error on composer
[InvalidArgumentException]
Could not find a matching version of package xxxxxxxx. Check the package spelling, your version constr
aint and that the package is available in a stability which matches your minimum-stability (dev).
Does anyone have a fully working solution for silverstripe 3?
Upvotes: 1
Views: 258
Reputation: 1499
what you are looking for is most likely the embargo module (https://github.com/silverstripe-terraformers/silverstripe-embargo-expiry). In combination with the queuedjobs modules (https://github.com/symbiote/silverstripe-queuedjobs) for scheduled jobs allows to schedule publishing and unpublishing of DataObjects (for example pages).
You can install the modules with:
composer require silverstripe-terraformers/embargo-expiry symbiote/silverstripe-queuedjobs
and add the configuration to the SiteTree:
SiteTree:
extensions:
- SilverStripe\Versioned\Versioned
- Terraformers\EmbargoExpiry\Extension\EmbargoExpiryExtension
Run dev/build afterwards and you should be able to set dates in the CMS.
On your production environment you will need to ensure to configure a cronjob similar to this:
*/1 * * * * php /path/to/silverstripe-project/framework/cli-script.php dev/tasks/ProcessJobQueueTask
For local testing you should be able to run:
php ./framework/cli-script.php dev/tasks/ProcessJobQueueTask
With the steps above you should be able to have expiry of pages set up in SilverStripe 3.x.
Cheers, Peter
Upvotes: 1