1 update.inc update_get_update_function_list($starting_updates)

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()

File

core/includes/update.inc, line 889
Backdrop 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 = backdrop_get_schema_versions($module);
    if ($updates !== FALSE) {
      $start_key = array_search($version, $updates);
      $total_updates = count($updates);
      for ($n = $start_key; $n < $total_updates; $n++) {
        $update = $updates[$n];
        $update_functions[$module][$update] = $module . '_update_' . $update;
      }
    }
  }
  return $update_functions;
}