brettt89 / silverstripe-garbage-collector
SilverStripe Garbage Collector module
Installs: 5 146
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 6
Forks: 7
Open Issues: 4
Requires
- php: ~8.0
- silverstripe/framework: ^4.13 | ^5
Requires (Dev)
- phpunit/phpunit: ^9.6.13
- silverstripe/versioned: ^1.8 | ^2
- squizlabs/php_codesniffer: ^3
- symbiote/silverstripe-queuedjobs: ^4.7 | ^5
- tractorcow/silverstripe-fluent: ^5.0 | ^6 | ^7
Suggests
- symbiote/silverstripe-queuedjobs: For usage of the GarbageCollectorJob within your application
This package is auto-updated.
Last update: 2024-12-16 22:43:41 UTC
README
Overview
SilverStripe Module for defining and processing Garbage Collection on SilverStripe Applications.
Installation
composer require brettt89/silverstripe-garbage-collector
Basic Usage
The below example shows how you can enable and configure the VersionedCollector and ChangeSetCollector for your application.
--- Name: GarbageCollectors --- SilverStripe\GarbageCollector\Collectors\VersionedCollector: # Increase Versioned keep limit to 10 records keep_limit: 10 # Define base classes to collect versions for base_classes: - SilverStripe\CMS\Model\SiteTree SilverStripe\GarbageCollector\Collectors\ChangeSetCollector: # Reduce Changeset Lifetime to 10 days deletion_lifetime: 10 # Register collectors with service SilverStripe\GarbageCollector\GarbageCollectorService: collectors: - 'SilverStripe\GarbageCollector\Collectors\VersionedCollector' - 'SilverStripe\GarbageCollector\Collectors\ChangeSetCollector' #Queue a RecurringAllGarbageCollectorJob if there isn't one already. It will then re-queue itself to run once a day. Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor: extensions: - 'SilverStripe\GarbageCollector\Extensions\QueuedJobDescriptorExtension'
The example setup will create a job that run all garbadge collectors every day after running dev build. It does this by calling GarbageCollectorService::inst()->process();
.
You also may decide to do this with some other process (BuildTask with Crontab that calls GarbageCollectorService::inst()->process();
)
Documentation
Garbage Collection is based on the idea of removal/processing of records and items that may not have native garbage collection. This should be extendable to work with any type of data set as long as there are corresponding processors.
Components
Guides
Reporting Issues
Please create an issue for any bugs you've found, or features you're missing.
License
This module is released under the MIT License
Credits
This project is made possible by the community surrounding it and especially the wonderful people and projects listed in this document.
Contributors
- Brett Tasker (https://github.com/brettt89)
- Mojmir Fendek (https://github.com/mfendeksilverstripe)