update_batch

6 update.php update_batch()
7 update.inc update_batch($start, $redirect = NULL, $url = NULL, $batch = array(), $redirect_callback = 'drupal_goto')
8 update.inc update_batch($start, $redirect = NULL, $url = NULL, $batch = array(), $redirect_callback = 'drupal_goto')

File

./update.php, line 257
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');
}
Login or register to post comments