Same name and namespace in other branches
  1. 7.x includes/update.inc \update_batch()

File

./update.php, line 260
Administrative page for handling updates from one Drupal version to another.

Code

function update_batch() {
  global $base_url;
  $operations = array();

  // Set the installed version so updates start at the correct place.
  foreach ($_POST['start'] as $module => $version) {
    drupal_set_installed_schema_version($module, $version - 1);
    $updates = drupal_get_schema_versions($module);
    $max_version = max($updates);
    if ($version <= $max_version) {
      foreach ($updates as $update) {
        if ($update >= $version) {
          $operations[] = array(
            'update_do_one',
            array(
              $module,
              $update,
            ),
          );
        }
      }
    }
  }
  $batch = array(
    'operations' => $operations,
    'title' => 'Updating',
    'init_message' => 'Starting updates',
    'error_message' => 'An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.',
    'finished' => 'update_finished',
  );
  batch_set($batch);
  batch_process($base_url . '/update.php?op=results', $base_url . '/update.php');
}