Advertising sustains the DA. Ads are hidden for members. Join today

Using restore scripts

Last updated on
30 April 2025

You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules

In order to use a generated script file, you still need a module to provide it, this will usually be in either an existing module you have built for the site, or an empty module specific for the scripts. In this module you just need a single hook to tell restore where to look:

/**
 * Implements hook_restore_scripts_location().
 */
function MY_MODULE_restore_scripts_location() {
  // This can be any location required, but in this example we are using [MY MODULE]/restore-scripts.
  return drupal_get_path('module', 'MY_MODULE') . '/restore-scripts';
}

Once the module has been setup, all you need to do is place any or all of your restore scripts into the defined scripts folder (in the example its [MY MODULE]/restore-scripts) and restore will find them. An example module is provided showing this usage, "restore_example_script" in the module/examples folder.

Help improve this page

Page status: Not set

You can: