PHPackages                             axllent/silverstripe-version-truncator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. axllent/silverstripe-version-truncator

ActiveSilverstripe-vendormodule[Framework](/categories/framework)

axllent/silverstripe-version-truncator
======================================

Automatically delete old versioned Silverstripe records from the database

4.0.0(1y ago)3673.1k↓11.8%11[1 issues](https://github.com/axllent/silverstripe-version-truncator/issues)3MITPHP

Since Dec 21Pushed 1y ago3 watchersCompare

[ Source](https://github.com/axllent/silverstripe-version-truncator)[ Packagist](https://packagist.org/packages/axllent/silverstripe-version-truncator)[ Docs](https://github.com/axllent/silverstripe-version-truncator)[ RSS](/packages/axllent-silverstripe-version-truncator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (14)Used By (3)

Version truncator for Silverstripe
==================================

[](#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](#configuration)).

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).

Features
--------

[](#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
-----

[](#tasks)

The module adds four manual tasks to:

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 in your browser via `/dev/tasks/TruncateVersionsTask`, or see `sake tasks:TruncateVersionsTask --help` for CLI options.

Requirements
------------

[](#requirements)

- Silverstripe ^6.0

Please see the `3` branch for Silverstripe 4 &amp; 5 support.

Installation
------------

[](#installation)

`composer require axllent/silverstripe-version-truncator`

Configuration
-------------

[](#configuration)

Configuration is optional (see [Default config](#default-config)), however you can create a YML file (eg: `app/_config/version-truncator.yml`):

```
MyCustomObject:
  keep_versions: 5
  keep_drafts: 5
```

To skip pruning altogether for a particular DataObject, set `keep_versions: 0` for that object class.

To overwrite the global defaults, see [`_config/extension.yml`](_config/extension.yml), eg:

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

Default config
--------------

[](#default-config)

### SiteTree (and extending classes eg: Page etc)

[](#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.

### All other DataObjects

[](#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).

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance46

Moderate activity, may be stable

Popularity43

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 97.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~283 days

Recently: every ~170 days

Total

13

Last Release

401d ago

Major Versions

1.0.0 → 2.0.02017-02-06

1.0.1 → 3.0.0-beta12021-03-14

3.x-dev → 4.0.02025-04-12

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1463435?v=4)[Ralph Slooten](/maintainers/axllent)[@axllent](https://github.com/axllent)

---

Top Contributors

[![axllent](https://avatars.githubusercontent.com/u/1463435?v=4)](https://github.com/axllent "axllent (44 commits)")[![yorikw](https://avatars.githubusercontent.com/u/20777356?v=4)](https://github.com/yorikw "yorikw (1 commits)")

---

Tags

frameworkdatabaseperformancesilverstripeversioneddataobjectsitetree

### Embed Badge

![Health badge](/badges/axllent-silverstripe-version-truncator/health.svg)

```
[![Health](https://phpackages.com/badges/axllent-silverstripe-version-truncator/health.svg)](https://phpackages.com/packages/axllent-silverstripe-version-truncator)
```

###  Alternatives

[silverstripe/cms

The SilverStripe Content Management System

5163.4M1.3k](/packages/silverstripe-cms)[silverstripe/behat-extension

SilverStripe framework extension for Behat

32564.2k5](/packages/silverstripe-behat-extension)[oddnoc/silverstripe-artefactcleaner

Find and optionally delete unused tables, columns and indexes in a SilverStripe database

1419.0k3](/packages/oddnoc-silverstripe-artefactcleaner)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
