Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Run datastore garbage collector on magnolia project via groovy shell
import info.magnolia.context.MgnlContext
// fill "repositories" list with one workspace for each repository defined in your repositories.xml jackrabbit configuration file
// (if you have different repositories using the same datastore modify this script according to http://wiki.apache.org/jackrabbit/DataStore#line-212)
def repositories = ["website", "media"]
def removedDataStoreEntries = 0
repositories.each() { repo ->
def session = MgnlContext.getHierarchyManager(repo).getWorkspace().getSession()
def gc = session.createDataStoreGarbageCollector()
try {
gc.mark()
removedDataStoreEntries += gc.sweep()
}
finally {
gc.close()
}
}
return removedDataStoreEntries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.