Updater Scripts
Introduction
Goal
Perform bulk changes to repository content using Groovy updater scripts.
Background
The Updater Editor allows developers to create, manage, and run Groovy updater scripts against a running repository from within the CMS UI. Updater scripts can perform bulk changes to existing content. For example, they can create a thumbnail of a particular size for every image of a certain type, or rename a certain field for all documents of type news.
In terms of functionality, this tool has many similarities with the JCR Runner forge project. However, the Updater Editor has three important advantages:
- Unlike for JCR Runners, you don't need to have Console access to the server in order to be able to run your updater scripts.
- The script runs within the same JVM as the repository and does not have to connect over RMI, which increases performance.
- A lot of information is logged about an updater run, including information that allows updates to be automatically undone.
Documentation
- Write an Updater Script
- Run an Updater Script
- Examples
- DocumentsInfoScript
- BinariesInfoScript
- Override Compilation Customizer for Groovy Updater Scripts
With Great Power Comes Great Responsibility
Updater scripts can modify large parts of your repository. Use them with care.Security
The scripts are executed via a custom Groovy ClassLoader which protects against obvious and trivial mistakes and misuse (for example invoking System.exit()). However this is not intended to provide a fully protected Groovy sandbox. This means that technically Groovy Updater scripts can be used to execute external programs, possibly compromising the server environment.Therefore protection against incorrect usage of Groovy updater scripts must be enforced by limiting the access and usage to trusted developers and administrators only.