function 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 mymodule.install file in the same directory as mymodule.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

update_resolve_dependencies()

hook_update_N()

Related topics

9 functions implement hook_update_dependencies()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

block_update_dependencies in drupal/core/modules/block/block.install
Implements hook_update_dependencies().
contact_update_dependencies in drupal/core/modules/contact/contact.install
Implements hook_update_dependencies().
field_sql_storage_update_dependencies in drupal/core/modules/field_sql_storage/field_sql_storage.install
Implements hook_update_dependencies().
file_update_dependencies in drupal/core/modules/file/file.install
Implements hook_update_dependencies().
overlay_update_dependencies in drupal/core/modules/overlay/overlay.install
Implements hook_update_dependencies().

... See full list

File

drupal/core/modules/system/system.api.php, line 2746
Hooks provided by Drupal core and the System module.

Code

function hook_update_dependencies() {

  // Indicate that the mymodule_update_8000() function provided by this module
  // must run after the another_module_update_8002() function provided by the
  // 'another_module' module.
  $dependencies['mymodule'][8000] = array(
    'another_module' => 8002,
  );

  // Indicate that the mymodule_update_8001() function provided by this module
  // must run before the yet_another_module_update_8004() 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 mymodule code, then the dependency declared here will be ignored.)
  $dependencies['yet_another_module'][8004] = array(
    'mymodule' => 8001,
  );
  return $dependencies;
}