function DbUpdateController::batchFinished

Same name in other branches
  1. 9 core/modules/system/src/Controller/DbUpdateController.php \Drupal\system\Controller\DbUpdateController::batchFinished()
  2. 10 core/modules/system/src/Controller/DbUpdateController.php \Drupal\system\Controller\DbUpdateController::batchFinished()
  3. 11.x core/modules/system/src/Controller/DbUpdateController.php \Drupal\system\Controller\DbUpdateController::batchFinished()

Finishes the update process and stores the results for eventual display.

After the updates run, all caches are flushed. The update results are stored into the session (for example, to be displayed on the update results page in update.php). Additionally, if the site was off-line, now that the update process is completed, the site is set back online.

Parameters

$success: Indicate that the batch API tasks were all completed successfully.

array $results: An array of all the results that were updated in update_do_one().

array $operations: A list of all the operations that had not been completed by the batch API.

File

core/modules/system/src/Controller/DbUpdateController.php, line 650

Class

DbUpdateController
Controller routines for database update routes.

Namespace

Drupal\system\Controller

Code

public static function batchFinished($success, $results, $operations) {
    // No updates to run, so caches won't get flushed later.  Clear them now.
    drupal_flush_all_caches();
    $_SESSION['update_results'] = $results;
    $_SESSION['update_success'] = $success;
    $_SESSION['updates_remaining'] = $operations;
    // Now that the update is done, we can put the site back online if it was
    // previously not in maintenance mode.
    if (empty($_SESSION['maintenance_mode'])) {
        \Drupal::state()->set('system.maintenance_mode', FALSE);
    }
    unset($_SESSION['maintenance_mode']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.