$maintenance_mode =
$this->state->
get('system.maintenance_mode', FALSE
);
// Store the current maintenance mode status in the session so that it can
// be restored at the end of the batch.
$request->
getSession()->
set('maintenance_mode',
$maintenance_mode);
// During the update, always put the site into maintenance mode so that
// in-progress schema changes do not affect visiting users.
if (empty($maintenance_mode)) { $this->state->
set('system.maintenance_mode', TRUE
);
} /** @var \Drupal\Core\Batch\BatchBuilder $batch_builder */
$batch_builder =
(new BatchBuilder()) ->
setTitle($this->
t('Updating'
)) ->
setInitMessage($this->
t('Starting updates'
)) ->
setErrorMessage($this->
t('An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.'
)) ->
setFinishCallback([DbUpdateController::
class, 'batchFinished'
]);
// Resolve any update dependencies to determine the actual updates that will
// be run and the order they will be run in.
$start =
$this->
getModuleUpdates();
$updates =
update_resolve_dependencies($start);
// Store the dependencies for each update function in an array which the