You are here

function update_get_update_function_list in Drupal 7

Same name and namespace in other branches
  1. 8 core/includes/update.inc \update_get_update_function_list()
  2. 9 core/includes/update.inc \update_get_update_function_list()

Returns an organized list of update functions for a set of modules.

Parameters

$starting_updates: An array whose keys contain the names of modules and whose values contain the number of the first requested update for that module.

Return value

An array containing all the update functions that should be run for each module, including the provided starting update and all subsequent updates that are available. The keys of the array contain the module names, and each value is an ordered array of update functions, keyed by the update number.

See also

update_resolve_dependencies()

1 call to update_get_update_function_list()
update_resolve_dependencies in includes/update.inc
Resolves dependencies in a set of module updates, and orders them correctly.

File

includes/update.inc, line 1285
Drupal database update API.

Code

function update_get_update_function_list($starting_updates) {

  // Go through each module and find all updates that we need (including the
  // first update that was requested and any updates that run after it).
  $update_functions = array();
  foreach ($starting_updates as $module => $version) {
    $update_functions[$module] = array();
    $updates = drupal_get_schema_versions($module);
    if ($updates !== FALSE) {
      $max_version = max($updates);
      if ($version <= $max_version) {
        foreach ($updates as $update) {
          if ($update >= $version) {
            $update_functions[$module][$update] = $module . '_update_' . $update;
          }
        }
      }
    }
  }
  return $update_functions;
}