Skip to content

brettt89/silverstripe-garbage-collector

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

SilverStripe Garbage Collection Module

PHPUnit codecov

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'

Now we just need to define an execution for the GarbageCollectorService by calling GarbageCollectorService::inst()->process();. You may decide to do this in a BuildTask or Job depending on how you want to execute Garbage Collection (e.g. Crontab).

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

Libraries

[silverstripe/framework] (https://github.com/silverstripe/silverstripe-framework)