W3cubDocs

/Drupal 8

function update_get_update_function_list

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 448
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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!update.inc/function/update_get_update_function_list/8.1.x