Magnolia 4.5 reached end of life on June 30, 2016. This branch is no longer supported, see End-of-life policy.
Magnolia Tools module is a collection of useful tools for manipulating repository content.
Download the module from Magnolia Store or Nexus repository.
Magnolia Tools is an Enterprise module. The module JAR files are available in the
add-ons folder under the Magnolia installation directory. To install the module, copy the JAR files to /WEB-INF/lib. See general module installation instructions.
See the general module uninstalling instructions and advice.
Used from command line or bean shell to remove corrupted nodes from a repository.
Log into BeanShell and execute the following script, adapting it to your specific case (workspace and node UUID):
import info.magnolia.context.*; import info.magnolia.*; import info.magnolia.tools.*; hm = MgnlContext.getSystemContext().getHierarchyManager("website"); // Change to appropriate workspace node = hm.getContentByUUID("be09e353-bd5c-45c2-be45-9324615720ca").getJCRNode(); // Change to get the appropriate node PersistenceManagerUtil.deleteNode(node, true, false);
bin/removenode script provided in the
./bin/removenode\ --webapp ~/tmp/current/webapps/magnoliaPublic\ --workspace website\ --uuid be09e353-bd5c-45c2-be45-9324615720ca\ --cleanupversions\ --detachonly
The first of the two boolean parameters above is for the
cleanupversions option. If set, the tool will try to retrieve and delete versions. The second boolean parameter is for
detachonly and should be used when the node can't be deleted even with this tool. With this set the tool will only try to detach the node from the hierarchy but will not attempt to remove it from the backend store. It also means that the node's UUID will no longer be available and previously exported content with such UUID can't be imported again without changing the UUID.
After removing the node (using BeanShell or command line), you need to reindex the workspace:
If you are using any kind of pooled or JNDI PersistenceManager which is configured in your container, you need to change the configuration to connect to the backing database directly with one of the core persistence managers to be able run the script from the command prompt since Magnolia Tools is not aware of your container's JNDI configuration. Depending on the PersistenceManager implementation, you might be able expose this configuration by setting system properties too.
Command to run throught the DataStore and remove all items without reference to clean the repository.
To run garbage collection:
If you have the Scheduler module installed you can execute the garbage collection command on Magnolia startup. By default this functionality is disabled. To make it work add
magnolia.datastoreGC.enabled to your system properties and set it's value to
As any other command, data store garbage collection can be configured as a scheduled job for periodic launches. See Scheduler configuration for instructions on configuring scheduled jobs. The command is in
/modules/tool/commands/tools/garbageCollector. If you pass the
repository parameter then garbage collection will be done for the specified repository only. When the
repository parameter is left out all repositories are cleaned.
Magnolia 4.4.3 and 4.4.4 (both CE and EE bundles) there is a conflict with
xmlParserAPIs-2.6.2 library when running Magnolia Tools in the shell. The workaround is to remove
xmlParserAPIs-2.6.2 library from your