Prune Old Versions Job
The Prune Old Page Versions built-in job allows you to automatically prune old page versions according to your requirements.
Over time, the number of revisions for each page will grow. Given that Confluence stores the entire content for each revision (rather than deltas), this can dramatically increase your database storage requirements.
For example:
- Remove versions older than three months on all spaces but always keep the latest three versions
- On spaces where you may have sensitive content, only keep the latest revision
The most recent version will never be deleted. Currently, this built-in job can only be applied to blog posts and pages.
Follow these steps to set up the job:
Your job now appears on the Jobs page of ScriptRunner. It will run when specified in the script, and you can choose to run it at other times. You can also enable and disable it.
Example
To remove versions older than 90 days and ensure there are always two historical versions, use this configuration:
Advanced example idea
It's possible to have a general configuration for all spaces, for example, keep all versions made within the last three months and a minimum of three, but more restrictive settings for certain spaces. You would do this simply by setting up two jobs.