We’ve been using Sitecore workflow for quite a while now. One of the great things about workflow is that each time a user wants to make a change to a published content item, it automatically creates a new item version for you. The only problem is that eventually, you start really accumulating A LOT of versions. We have some items with 100 or more versions! As discussed on SDN, in order to prevent performance issues it is advisable to delete old/unused versions.
There are several options available as outlined by John West to remove old versions. They each have their pros/cons. The ‘VersionManager’ module has the advantage that it backs up the removed versions before deleting them by serializing the entire item to a XML file. This actually writes ALL versions to the XML file. In order to keep track of which versions were deleted, the file name encodes the versions that were deleted.
We were all set to use VersionManager but ran into a snag.. When a user creates a new version, it attempted to delete the old versions in excess of the currently set maximum. The problem was that the users do not have ‘delete rights’.
This led me to start investigating a different approach. After some lengthy comment exchanging with John West on his post about ‘Remove Old Versions…’, I settled on creating a scheduled task that would include the serialization from VersionManager but would run in the background.
And so I created the ‘Sitecore Version Pruner’ module.
As detailed on the Sitecore Marketplace page, the module..
“is a scheduled task that removes old/unused item versions from your content tree. Removed version(s) may be preserved as serialized XML and/or (BETA) copied to the archive database.”
It basically meets the same requirements as VersionManager except:
- It runs as a background task. No need for users to have ‘delete’ rights
- It uses the Sitecore Rules Engine to define the “pruning” rules (credit to John West for the idea)
- In addition to serialization, it also provides an option to archive the deleted versions to the archive database. Read more about this feature on the about tab here.
I have to give a lot of the credit to John West and Ivan Buzyka (VersionManager module author). I basically took their solutions and combined them.