Magnolia 5.4 reached end of life on November 15, 2018. This branch is no longer supported, see End-of-life policy.

Page tree
Skip to end of metadata
Go to start of metadata

This page provides a recommended approach to avoid any inconsistent configuration occurring when you upgrade a custom Magnolia bundle with STK, MultisiteSite and Site app modules. 

If you upgrade the STK module in a custom bundle before installing the site-app module, you may encounter issues with the rootPath and app launcher configuration.

You encounter these issues if, for example, you:

  1. Have Magnolia 5.4.3 with STK 2.9.2 installed, but you do not have the Site app module installed.
  2. Upgrade to Magnolia 5.4.4 with STK 2.9.3.
  3. Add Site app 1.0.5 to your custom bundle.
  4. Upgrade to Site module 1.0.5.
  5. Upgrade to imaging-support 3.2.5 (needed by site-module 1.0.5).

Run a Groovy Script to fix your configuration

The script provided below cleans up your configuration by:

  • Setting the new rootPath value.
  • Removing any apps that are not in the app registry (this fixes the app launcher configuration).

See the Groovy module and Groovy app for information about how to execute Groovy scripts on a running Magnolia instance.

  1. Go to Dev > Groovy.
  2. Click Add script to create a new script in the Groovy module.
  3. Paste the following script into the Source field.

    session = ctx.getJCRSession('config')
    updatedConfig = false
    
    def removeNode(absPath) {
      if (session.nodeExists(absPath)) {
          println "Removing config:$absPath ..."
          session.removeItem(absPath)
          updatedConfig = true
      }
    }
    
    if (session.nodeExists('/modules/multisite') && session.nodeExists('/modules/site-app') && session.nodeExists('/modules/standard-templating-kit')) {
        println "Detected multisite, site-app and stk modules. Let's see if configuration needs some clean up..."
    
        siteAppContentConnector = session.getNode('/modules/site-app/apps/site/subApps/browser/contentConnector')
    
        if ('/modules/site/config/site'.equals(PropertyUtil.getString(siteAppContentConnector, 'rootPath'))) {
            println 'Replacing config:/modules/site-app/apps/site/subApps/browser/contentConnector@rootPath value /modules/site/config/site with /modules/multisite/config/sites ...'
            PropertyUtil.setProperty(siteAppContentConnector, 'rootPath', '/modules/multisite/config/sites')
            updatedConfig = true
        }
        removeNode('/modules/ui-admincentral/apps/stkSiteApp')
        removeNode('/modules/ui-admincentral/config/appLauncherLayout/groups/stk/apps/stkSiteApp')
        removeNode('/modules/ui-admincentral/apps/stkThemesApp')
        removeNode('/modules/ui-admincentral/config/appLauncherLayout/groups/stk/apps/stkThemesApp')
        session.save()
    }
    
    if (updatedConfig) {
      return 'Configuration cleaned up. Bye.'
    } else {
      return 'Nothing to do here. Bye.'
    }
  4. Check the Is a script? box.
  5. Save the script and run it after upgrading.



  • No labels