Skip to content
Permalink
Browse files

[update:execute] run trailing post updates if there is no updates (#3996

)

* run trailing post updates if there is no updates

* current master is not compatible with actual core 1.8

* fix runPostUpdates argument missing

* revert drupal/console-core version

* use new maintenance mode
  • Loading branch information...
lalop authored and LOBsTerr committed Apr 23, 2019
1 parent f463c75 commit 7f914f7730741f28d20892e7460f32014c4a0036
Showing with 16 additions and 29 deletions.
  1. +16 −29 src/Command/Update/ExecuteCommand.php
@@ -108,7 +108,8 @@ protected function configure()
$this->trans('commands.update.execute.options.update-n'),
'9000'
)
->setAliases(['upex']);
->setAliases(['upex'])
->enableMaintenance();
}
/**
@@ -151,38 +152,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
)
);
}
return 0;
}
$maintenanceMode = $this->state->get('system.maintenance_mode', false);
if (!$maintenanceMode) {
$this->getIo()->info($this->trans('commands.site.maintenance.description'));
$this->state->set('system.maintenance_mode', true);
}
try {
$this->runUpdates(
$updates
);
// Post Updates are only safe to run after all schemas have been updated.
if (!$this->getUpdates()) {
$this->runPostUpdates();
} else {
try {
$this->runUpdates(
$updates
);
} catch (\Exception $e) {
watchdog_exception('update', $e);
$this->getIo()->error($e->getMessage());
return 1;
}
} catch (\Exception $e) {
watchdog_exception('update', $e);
$this->getIo()->error($e->getMessage());
return 1;
}
if (!$maintenanceMode) {
$this->state->set('system.maintenance_mode', false);
$this->getIo()->info($this->trans('commands.site.maintenance.messages.maintenance-off'));
}
// Post Updates are only safe to run after all schemas have been updated.
if (!$this->getUpdates()) {
$this->runPostUpdates($postUpdates);
$this->chainQueue->addCommand('update:entities');
}
@@ -274,6 +260,7 @@ private function runUpdates(
private function runPostUpdates()
{
$postUpdates = $this->postUpdateRegistry->getPendingUpdateInformation();
foreach ($postUpdates as $module => $updates) {
foreach ($updates['pending'] as $updateName => $update) {
$this->getIo()->info(

0 comments on commit 7f914f7

Please sign in to comment.
You can’t perform that action at this time.