1 system.api.php hook_update_dependencies()

Return an array of information about module update dependencies.

This can be used to indicate update functions from other modules that your module's update functions depend on, or vice versa. It is used by the update system to determine the appropriate order in which updates should be run, as well as to search for missing dependencies.

Implementations of this hook should be placed in a my_module.install file in the same directory as my_module.module.

Return value

A multidimensional array containing information about the module update: dependencies. The first two levels of keys represent the module and update number (respectively) for which information is being returned, and the value is an array of information about that update's dependencies. Within this array, each key represents a module, and each value represents the number of an update function within that module. In the event that your update function depends on more than one update from a particular module, you should always list the highest numbered one here (since updates within a given module always run in numerical order).

See also



Related topics


core/modules/system/system.api.php, line 2993
Hooks provided by Backdrop core and the System module.


function hook_update_dependencies() {
  // Indicate that the my_module_update_1000() function provided by this module
  // must run after the another_module_update_1002() function provided by the
  // 'another_module' module.
  $dependencies['my_module'][1000] = array(
    'another_module' => 1002,
  // Indicate that the my_module_update_1001() function provided by this module
  // must run before the yet_another_module_update_1004() function provided by
  // the 'yet_another_module' module. (Note that declaring dependencies in this
  // direction should be done only in rare situations, since it can lead to the
  // following problem: If a site has already run the yet_another_module
  // module's database updates before it updates its codebase to pick up the
  // newest my_module code, then the dependency declared here will be ignored.)
  $dependencies['yet_another_module'][1004] = array(
    'my_module' => 1001,
  return $dependencies;