Created
February 15, 2012 16:22
-
-
Save molaschi/1837029 to your computer and use it in GitHub Desktop.
Run datastore garbage collector on magnolia project via groovy shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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