Skip to content

Instantly share code, notes, and snippets.

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
def repositories = ["website", "media"]
def removedDataStoreEntries = 0
repositories.each() { repo ->
def session = MgnlContext.getHierarchyManager(repo).getWorkspace().getSession()
def gc = session.createDataStoreGarbageCollector()
try {
removedDataStoreEntries += gc.sweep()
finally {
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.