Magnolia CMS: find references of any assets in all repositories

This Groovy code runs on any Magnolia CMS instance and helps you to find unused assets. It checks if an asset is linked within another repository.

It does not check if you link to an asset by URI. And of course it can not check if the asset is linked from somewhere else in the web.

import info.magnolia.module.dependencies.impl.DefaultDependencies
import info.magnolia.cms.beans.config.ContentRepository
import info.magnolia.cms.core.Content
import info.magnolia.cms.util.ContentUtil
import info.magnolia.cms.util.DumperUtil
import javax.jcr.Node;
session = ctx.getJCRSession("dam")
query = session.getWorkspace().getQueryManager().createQuery("select node.* from [mgnl:asset]", "JCR-SQL2")
// for debugging: start with a small amount if nodes
nodes = query.execute().getNodes()
dependencies = new DefaultDependencies()
// save the output to a file
File file = new File("/tmp/unusedAssets.txt")
def i = 0
def found = false
nodes.each { Node node ->
 for (workspace in ContentRepository.getAllRepositoryNames()) {
 // this is an optional whitelist of repositories
 if(workspace.startsWith("offer") || workspace.startsWith("product") || workspace.startsWith("website") || workspace.startsWith("rm-") || workspace.startsWith("category") || workspace.startsWith("resources") || workspace.startsWith("data")) {
 if(dependencies.getReferencesTo(node, workspace).isEmpty()) {
 found = true
 // sleep every 20 nodes, otherwise the instance may be locked
 if (i % 20 == 0) {
 // write node names to the file for later investigation
 if (found) {
 file << node.getPath()+"\r\n"
 found = false

Düsseldorf „Open Playground“ erfolgreich beendet

Düsseldorf Open Playground by Stöer
Düsseldorf Open Playground by Stöer

Neues von unserem #IoT-Projekt mit #Magnolia und Android:

„Der Open Playground hat gezeigt, dass von den durchschnittlich täglich 250.000 Bahnhofsbesuchern rund 40 Prozent Bluetooth aktiviert haben. Philips, Loreal, die Agentur, die Sparkassen-Finanzportal GmbH und ein Softgetränkehersteller nutzten den Open Playground, um iBeacon Kampagnen in ihrer Zielgruppe zu testen.“

Tachty erhält den Ritterschlag zur Agentur 😉
Danke an Martin und Martin, es hat Spaß gemacht!

Düsseldorf „Open Playground“ erfolgreich beendet weiterlesen

Review: Magnolia Conference 2015 / Basel

Magnolia Conference 2015 is over – but you can relive the event with our videos and slides!

For videos, keep an eye on this playlist – you may find a talk with me speaking about the internet of things 😉

For slides, search for mconf15 on SlideShare:

Magnolia releases final update for Magnolia 4.4 series

Source: Magnolia Forum

Magnolia CMS 4.4.8 is now available, and fixes issues related to concurrent activation, recursive activation and content locking. It is a recommended update for all users of Magnolia CMS 4.4.x.

Please note that this is currently the last update of the 4.4.x series we’re planning; please consider upgrading to 4.5.x ! 🙂

See the release notes for more details:

Aggregated change-log: