codeflood logo

Initialisation Scripts

For Revolver version 3+

Revolver can execute a number of scripts when a session starts. This allows users to setup their environment as required.

The following scripts will be executed in this order, if they exist. Normally an error will be raised if the user attempts to execute a script which does not exist, but for initialisation scripts, if the script doesn't exist, it will not raise an error.

  1. init
  2. init-<roles>
  3. init-<user>

init

The first script to be executed is the script named init. This script will be executed for all users.

init-<roles>

The users roles will be enumerated and the init script for each role by lowercase name (without the domain) will be attempted to be executed. So if the user belongs to the sitecore\Developer and sitecore\Maintenance roles, then scripts by name init-developer and init-maintenance will be executed. The role init scripts are executed for each user in that role when they start a new session.

init-<user>

The last init script will be the users init script, given by the users lowercase name without the domain. So if the users name is sitecore\Dean then the init-dean script will be executed.

Example

Let's take the above examples and combine them. For the user sitecore\dean who belongs to the sitecore\Developer and sitecore\Maintenance roles, the following scripts will be executed in order:

  1. init
  2. init-developer
  3. init-maintenance
  4. init-dean

Script location

Init scripts do not need to be found in a specific script locator. All locators will be searched. As normal, scripts must be uniquely named across all providers. So you cannot have a script named init on the file system and also in the core DB. There can only be a single script named init.