System Administrator Jahia 7.3 Jahia 8 Legacy

Check consistency of specific nodes

Question

How can I check the consistency of specific nodes at the Jackrabbit level?

Answer

Using the JCR Integrity Tools

Open the JCR Integrity Tools (DX_URL/modules/tools/jcrIntegrityTools.jsp) and provide the UUID of the specific node to start running the check from.

If you need to do the operations on several nodes, it is best to use a Groovy script.

Using a Groovy script

Open the Groovy console (DX_URL/modules/tools/groovyConsole.jsp)  and execute the script below (do not forget to add the list of UUIDs to check):

import org.apache.jackrabbit.core.persistence.PersistenceManager;
import org.jahia.services.content.impl.jackrabbit.SpringJackrabbitRepository;
import org.jahia.services.SpringContextSingleton;

def String[] uuids = ["6e45a064-a1ce-466f-a19e-4441f3aeb21a"];
def boolean doFix = false;

PersistenceManager pm = ((SpringJackrabbitRepository) SpringContextSingleton.getBean("jackrabbit")).getRepository().getWorkspaceInfo("default").getPersistenceManager();
pm.checkConsistency(uuids, true, doFix);

pm = ((SpringJackrabbitRepository) SpringContextSingleton.getBean("jackrabbit")).getRepository().getWorkspaceInfo("live").getPersistenceManager();
pm.checkConsistency(uuids, true, doFix);

pm = ((SpringJackrabbitRepository) SpringContextSingleton.getBean("jackrabbit")).getRepository().getContext().getInternalVersionManager().getPersistenceManager();
pm.checkConsistency(uuids, true, doFix);