Issue
In a standard CQ installation, you can run the version purge manually OR explicitly when new versions of assets are created. You can also schedule version purge to run at specified time.
Solution
Using cron job, schedule the curl commands [1], and then remove the progress file. The following list explains the various input parameters.
- <cmd> The value can be "dryrun" OR "purge." The value "dryrun" helps to preview the purged versions. And, value "purge" launches the purge of the versions on the node that the path defines.
- <maxdays> The maximum age of the version of a node. When the age of a version exceeds this value, it is purged.
- <maxversions> The maximum number of versions to keep for a node. When this number exceeds this value, the oldest versions are purged.
- <path> An absolute path on which the purge is applied.
- <recursive> When purging data, you can choose between performing the operation on one node or on a whole hierarchy by selecting Recursive.
For more details, click here.
An example of curl command to purge everything except last five versions for the tree/content/geometrixx/en/test is [2] & [3].
[1]
curl -u <userid>:<password> -f -o progress.txt -d "cmd=<cmd>&maxdays=<maxdays>&maxversions=<maxversions>&path=<path>&recursive=<recursive>" "http://<host>:<port>/etc/versioning/purge.html"
[2]
curl -u admin:admin -f -o progress.txt -d "cmd=purge&maxdays=0&maxversions=5&path=/content/geometrixx/en/test&recursive=true" "http://localhost:4502/etc/versioning/purge.html"
[3]
rm progress.txt