function drush_update_batch

8.0.x drush_update_batch()
8.0.x drush_update_batch($start)
6.x drush_update_batch($start)
6.x drush_update_batch($start)
7.x drush_update_batch($start)
7.x drush_update_batch($start)
3.x drush_update_batch($start)
4.x drush_update_batch($start)
5.x drush_update_batch($start)
5.x drush_update_batch($start)
master drush_update_batch()
master drush_update_batch($start)

Start the database update batch process.


$start: An array of all the modules and which update to start at.

$redirect: Path to redirect to when the batch has finished processing.

$url: URL of the batch processing page (should only be used for separate scripts like update.php).

$batch: Optional parameters to pass into the batch API.

$redirect_callback: (optional) Specify a function to be called to redirect to the progressive processing page.

2 calls to drush_update_batch()
update_main in commands/core/drupal/
update_main in commands/core/drupal/


commands/core/drupal/, line 172
Update.php for provisioned sites. This file is a derivative of the standard drupal update.php, which has been modified to allow being run from the command line.


function drush_update_batch($start) {
  $start = drush_get_update_list();
  // Resolve any update dependencies to determine the actual updates that will
  // be run and the order they will be run in.
  $updates = update_resolve_dependencies($start);

  // Store the dependencies for each update function in an array which the
  // batch API can pass in to the batch operation each time it is called. (We
  // do not store the entire update dependency array here because it is
  // potentially very large.)
  $dependency_map = array();
  foreach ($updates as $function => $update) {
    $dependency_map[$function] = !empty($update['reverse_paths']) ? array_keys($update['reverse_paths']) : array();

  $operations = array();

  // First of all perform entity definition updates, which will update
  // storage schema if needed, so that module update functions work with
  // the correct entity schema.
  if (\Drupal::service('entity.definition_update_manager')->needsUpdates()) {
    $operations[] = array('update_entity_definitions', array('system', '0 - Update entity definitions'));

  foreach ($updates as $update) {
    if ($update['allowed']) {
      // Set the installed version of each module so updates will start at the
      // correct place. (The updates are already sorted, so we can simply base
      // this on the first one we come across in the above foreach loop.)
      if (isset($start[$update['module']])) {
        drupal_set_installed_schema_version($update['module'], $update['number'] - 1);
      // Add this update function to the batch.
      $function = $update['module'] . '_update_' . $update['number'];
      $operations[] = array('drush_update_do_one', array($update['module'], $update['number'], $dependency_map[$function]));

  $batch['operations'] = $operations;
  $batch += array(
    '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' => array('finished' => array('\Drupal\system\Controller\DbUpdateController', 'batchFinished')),
    'file' => 'includes/',
  \Drupal::service('state')->set('system.maintenance_mode', TRUE);
  \Drupal::service('state')->set('system.maintenance_mode', FALSE);