From d9d43eea27156f12e6a0b6fdbe9a5db774622574 Mon Sep 17 00:00:00 2001 From: Neil Drumm Date: Mon, 14 Aug 2006 05:47:36 +0000 Subject: #64212 by chx, dww, and Eaton, allow for branched updates. --- update.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'update.php') diff --git a/update.php b/update.php index 3713d2178..039e882ac 100644 --- a/update.php +++ b/update.php @@ -337,11 +337,18 @@ function update_selection_page() { if ($updates !== FALSE) { $updates = drupal_map_assoc($updates); $updates[] = 'No updates available'; + $default = drupal_get_installed_schema_version($module); + foreach (array_keys($updates) as $update) { + if ($update > $default) { + $default = $update; + break; + } + } $form['start'][$module] = array( '#type' => 'select', '#title' => $module . ' module', - '#default_value' => array_search(drupal_get_installed_schema_version($module), $updates) + 1, + '#default_value' => $default, '#options' => $updates, ); } @@ -369,10 +376,13 @@ function update_update_page() { // Set the installed version so updates start at the correct place. foreach ($_POST['edit']['start'] as $module => $version) { drupal_set_installed_schema_version($module, $version - 1); - $max_version = max(drupal_get_schema_versions($module)); + $updates = drupal_get_schema_versions($module); + $max_version = max($updates); if ($version <= $max_version) { - foreach (range($version, $max_version) as $update) { - $_SESSION['update_remaining'][] = array('module' => $module, 'version' => $update); + foreach ($updates as $update) { + if ($update >= $version) { + $_SESSION['update_remaining'][] = array('module' => $module, 'version' => $update); + } } } } -- cgit v1.2.3