Commit 3604231d authored by webchick's avatar webchick

#521838 follow-up by jrchamp: Clean up drupal_get_schema_versions().

parent 88941380
......@@ -95,6 +95,11 @@ function drupal_get_schema_versions($module) {
$updates = &drupal_static(__FUNCTION__, NULL);
if (!isset($updates[$module])) {
$updates = array();
foreach (module_list() as $loaded_module) {
$updates[$loaded_module] = array();
}
// Prepare regular expression to match all possible defined hook_update_N().
$regexp = '/^(?P<module>.+)_update_(?P<version>\d+)$/';
$functions = get_defined_functions();
......@@ -117,7 +122,7 @@ function drupal_get_schema_versions($module) {
sort($module_updates, SORT_NUMERIC);
}
}
return isset($updates[$module]) ? $updates[$module] : FALSE;
return empty($updates[$module]) ? FALSE : $updates[$module];
}
/**
......
......@@ -1041,11 +1041,13 @@ function update_get_update_function_list($starting_updates) {
foreach ($starting_updates as $module => $version) {
$update_functions[$module] = array();
$updates = drupal_get_schema_versions($module);
$max_version = max($updates);
if ($version <= $max_version) {
foreach ($updates as $update) {
if ($update >= $version) {
$update_functions[$module][$update] = $module . '_update_' . $update;
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;
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment