2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe 3

image

axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe 3

  • Monday, April 16, 2018
  • by axllent
  • Repository
  • 2 Watchers
  • 30 Stars
  • 5,667 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 9 Versions
  • 26 % Grown

The README.md

Version truncator for Silverstripe

An extension for Silverstripe to automatically delete old versioned DataObject records from your database when a record is published, following predefined retention policies (see configuration)., (*1)

When a record is being edited (such as a Page), no changes are made until it is published, so it could have 50 draft versions while you work on the copy. When you publish the page, the module prunes the (by default) all draft copies, leaving just the 10 latest published versions (configurable)., (*2)

Features

  • Delete all but the last XX published versions of a DataObject on publish
  • Delete all but the last YY draft versions of a DataObject on publish
  • Optionally keep old SiteTree objects where the URLSegment has changed (to preserve redirects)

Tasks

The module adds three manual tasks to:, (*3)

  1. Force a run over the entire database - this task is generally not needed unless you either just install the module and wish to tidy up, or change your DataObject configurations.
  2. Silverstripe does not currently delete any File records once the file had been physically deleted (probably due to the immediate post-delete functionality relating to internal file linking). I cannot see any purpose of keeping these records after this, so this task will remove all records pertaining to deleted files/folders.
  3. Force a "reset", keeping only the latest published version of each currently published DataObject (regardless of policy). Unpublished / modified DataObjects are not touched.
  4. Delete all archived DataObjects.

The tasks can be run via /dev/tasks/TruncateVersionsTask., (*4)

Requirements

  • Silverstripe ^4.5 || ^5.0

Installation

composer require axllent/silverstripe-version-truncator, (*5)

Configuration

Configuration is optional (see Default config), however you can create a YML file (eg: app/_config/version-truncator.yml):, (*6)

MyCustomObject:
  keep_versions: 5
  keep_drafts: 5

To skip pruning altogether for a particular DataObject, set keep_versions: 0 for that object class., (*7)

To overwrite the global defaults, see _config/extension.yml, eg:, (*8)

SilverStripe\CMS\Model\SiteTree:
  keep_versions: 20
  keep_drafts: 10

Default config

SiteTree (and extending classes eg: Page etc)

On publish, the last 10 published versions are kept, and all draft copied are removed. The only exception is if the URLSegment and/or ParentID is has changed, in which case the module will keep a single record for each differing URLSegment to allow auto-redirection., (*9)

All other DataObjects

For all other versioned DataObjects, only the latest published version is kept, and all drafts deleted. This can be adjusted per DataObject, or globally (see above)., (*10)

The Versions

16/04 2018

dev-silverstripe3

dev-silverstripe3 https://github.com/axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe 3

  Sources   Download

MIT The MIT License (MIT)

The Requires

 

cms silverstripe sitetree

06/02 2018

dev-master

9999999-dev https://github.com/axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe

  Sources   Download

MIT The MIT License (MIT)

The Requires

 

cms silverstripe sitetree

06/02 2018

1.0.1

1.0.1.0 https://github.com/axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe

  Sources   Download

MIT

The Requires

 

cms silverstripe sitetree

17/10 2017

2.0.3

2.0.3.0 https://github.com/axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

cms silverstripe sitetree

04/08 2017

2.0.2

2.0.2.0 https://github.com/axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

cms silverstripe sitetree

07/06 2017

2.0.1

2.0.1.0 https://github.com/axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe

  Sources   Download

The MIT License (MIT)

The Requires

 

cms silverstripe sitetree

06/02 2017

2.0.0

2.0.0.0 https://github.com/axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe 3

  Sources   Download

The MIT License (MIT)

The Requires

 

cms silverstripe sitetree

21/12 2015

1.0.0

1.0.0.0 https://github.com/axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe 3

  Sources   Download

The MIT License (MIT)

The Requires

 

cms silverstripe sitetree

02/12 2014

dev-development

dev-development https://github.com/axllent/silverstripe-version-truncator

Automatically delete old SiteTree page versions from SilverStripe 3

  Sources   Download

The MIT License (MIT)

The Requires

 

cms silverstripe sitetree