/** @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
// 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 =
[];
foreach ($updates as $function =>
$update) { $dependency_map[$function] = !
empty($update['reverse_paths'
]) ?
array_keys($update['reverse_paths'
]) :
[];
}