function update_get_update_function_list
Same name in other branches
- 7.x includes/update.inc \update_get_update_function_list()
- 9 core/includes/update.inc \update_get_update_function_list()
- 8.9.x core/includes/update.inc \update_get_update_function_list()
- 11.x 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
array 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
1 call to update_get_update_function_list()
- update_resolve_dependencies in core/
includes/ update.inc - Resolves dependencies in a set of module updates, and orders them correctly.
File
-
core/
includes/ update.inc, line 478
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 = [];
/** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */
$update_registry = \Drupal::service('update.update_hook_registry');
foreach ($starting_updates as $module => $version) {
$update_functions[$module] = [];
$updates = $update_registry->getAvailableUpdates($module);
if ($updates) {
$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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.