Version Cleaner module
Edition |
Incubator (services) |
||
Git |
|||
Latest |
1.6.2
|
The Version Cleaner module provides commands to remove old or duplicated versions from your version store. Which versions are selected for removal can be configured through voters.
Analyzing and removing unneeded versions can take a lot of time, the version cleanup command can be configured to examine a set number of versions (actually nodes in the version workspace) and then stop. The next run of the version cleanup command will resume from the node last analyzed.
The version cleaner can be configured to select which versions are deleted or retained.
|
This module is at the INCUBATOR level. |
Installing with Maven
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency>
<groupId>info.magnolia.services</groupId>
<artifactId>versioncleaner</artifactId>
<version>1.6.2</version>
</dependency>
Usage
The module provides a set of commands for removing selected versions from the version history.
Which versions are selected for deletion are configurable through voters. You can define complex conditions to identify if a version should be deleted.
Cleanup Commands
The cleanup commands can be found in the version cleaner catalog: /module/versioncleaner/commands/cleanup.
| Command | Description | ||
|---|---|---|---|
|
Remove unneeded versions according to its configuration. |
||
|
Remove all versions found except root and leaf versions.
|
||
|
Clean versions from a workspace and path. |
cleanVersions and cleanAllVersions work directly on the JCR version workspace. They clean versions from all workspaces with versions.
cleanNodeVersions however cleans versions from a specific workspace and optional path. Unlike cleanVersions and cleanAllVersions, cleanNodeVersions will not resume its cleaning run after reaching its visitLimit; it doesn’t save its progress while cleaning versions. cleanNodeVersions does not archive versions before deleting them.
The cleanVersions and cleanAllVersions commands can be configured with the following parameters when invoked:
| Parameter | Description | ||
|---|---|---|---|
|
true or false (the default) Does a "dry run", going through the selected versions but without deleting or modifying them. |
||
|
true or false (the default) If true, will save an export of each version to be deleted to the specified
|
||
|
Directory for storing archived versions and cleaning run history. Defaults to:
|
||
|
The maximum number of version nodes that will be checked during a run. Defaults to
|
These parameters can also be set as properties in the command configuration, at /module/versioncleaner/commands/cleanup/cleanVersions or /module/versioncleaner/commands/cleanup/cleanAllVersions.
|
Diagnostic Commands
The diagnostic commands can be found in the version cleaner catalog /module/versioncleaner/commands/diagnostic.
| Command | Description |
|---|---|
|
Locate corrupted versions in the version workspace. A version is corrupt if it:
|
Configuring Cleanup
The versions selected for removal by the cleanVersions, cleanAllVersions and cleanNodeVersions commands are controlled by Voters. The voters determine if a versions should be deleted (the result of the voting is true) or retained (the result of the voting is false).
You can combine the results of different voters with logical operations (and, or, xor…).
Each command can be configured with the pruneVersions property:

Version Voters
You can use the following voters to identify versions to be deleted or retained:
- EligibleVersionVoter
-
EligibleVersionVoterreturns true if the version is not a root version (the first version of a node) or a leaf version (the last version of a node).
Class: info.magnolia.services.cleanup.commands.voters.EligibleVersionVoter
- NoModificationVoter
-
NoModificationVoterreturns true if the version has the same modification date as the previous version or false if the modification dates are different.
Class: info.magnolia.services.cleanup.commands.voters.NoModificationVoter
- OldVersionVoter
-
OldVersionVoterreturns true if the version is older than the maxAge threshold or false otherwise.
Class: info.magnolia.services.cleanup.commands.voters.OldVersionVoter
| Property | Description |
|---|---|
|
optional The age threshold in milliseconds. Defaults to 90 days (i.e. |
- UnneededVersionVoter
-
UnneededVersionVoterreturns true if there are at leastversionsThresholdnewer versions and false otherwise. UseUnneededVersionVoterto limit the total number of versions retained.
Class: info.magnolia.services.cleanup.commands.voters.UnneededVersionVoter
| Property | Description |
|---|---|
|
optional The number of versions to be retained. Defaults to |
Changelog
| Version | Notes |
|---|---|
|
Corrected ordering of version workspace traversal |
|
Corrected naming for pruning configuration for |
|
|