How to diff various Enonic CMS installations

Posted by

When working with big installations, where production, test and development environments are present and multiple developers are working at the same time, it's nice to know what's happening. Our diff tool shows a possible solution to track changes and visualize differences.

How it works?

Our dbtool offers a method, which is a bit forgotten, called 'extract'. With the usage of the extract method, it's possible to generate an xml file, which contains: sites, portlets, page templates, datasources, methods, parameters and even content types.

Generating extract from production and test environment makes it possible to compare these. To compare extract files one could use a file diff tool, but considering the size of the files it would not be convenient. So we made a simple xsl file that generates a report from the extracted xml files. The reports pinpoint out the differences between given environments.

How to use it?

First of all we need to generate extracts. I used the demokit database and generated a cms_extrac-prod.xml and cms_extract-test.xml. In the 2 installations I did some changes in datasource parameters.

Extract files shall be placed under /data/ folder. In this folder a  config.xml  can be found, this has to be updated accordingly:

Everything is set up now, we are ready to compare. We used the  Saxon-HE 9.4  edition to execute the conversion (see

After exectuion in the  out  folder an  index.html  can be found. There you can see what is the difference between the 2 installations. By default difference is shown, marked with red background. If you click around you will see that we added some level of interactivity, so all datasources and templates can be viewed.


Final thoughts

As the execution of the dbtool's extract is not resource intensive, it could be executed often. During active development period a cronjob could regenerate the extract and execute the compare in every 10 minutes for example. If the generated files are shared out through a web server all team members can see what has happened lately with the installation. It's also wise to compare installations before/after rollouts.

Attached a package with our Demokit compare package. You should be able to reuse it in you own environment after updating the configuration file.