Purging revisions of an object

we have revisions configured in some customer's site because they want to be able to track changes on news items; we have configured a limit of 50 versions and that seems to be working.

on the same site we have versioning enabled for other content type that we don't want to track, but this is needed to allow editing via checkout and checkin (using plone.app.iterate).

our problem is objects size grows a lot aborting the checkout process (because browser timeout) and we need to purge all revisions from time to time manually.

is there any way to purge a number of revisions automatically?

I was thinking on a subscriber based in some code of collective.revisionmanager but it's pretty complicated for me.

@tschorr can you give me some hints?

BTW, this is related with this issue:

@hvelarde there is a subscriber in Products.CMFEditions that purges the history of a content object about to be deleted (https://github.com/plone/Products.CMFEditions/blob/master/Products/CMFEditions/subscriber.py#L74). Maybe this helps?

1 Like

thanks! yes, it helps.

@alert pointed to this handy script:

I'm going to use it meanwhile with a crontab job.

@tschorr A cool! I was wondering why I still have a lot of orphaned objects in exiting Plone sites, but you added this in 2016, so it's fairly new :+1::+1:

@fredvd for sites that were using versions of Products.CMFEditions < 3.0 collective.revisionmanager might help you to clean up.