axllent/silverstripe-version-truncator — pull request #4 by jonom (2014-11-16 02:14:33+00:00)
Title: Preserve URL History and add Build Tasks

Fixes #3 and adds tasks for truncating on all pages at once and removing deleted pages.

Certainly some things that could be cleaned up but hopefully a good starting point.

Note that the way I've excluded 'protected' records currently will mess with the $version_limit as they're removed before the offset is applied, meaning you'll get at least one more record than you want left behind. Might be better to leave the DB query how you had it, then scrub the array of records to delete against a whitelist to remove any protected records.