Skip to content
Permalink
Browse files

[update:execute] Fixed update table (#4060)

  • Loading branch information...
harold20 authored and enzolutions committed May 23, 2019
1 parent db15e4e commit ac553b727427d0c913aa18424f5941ed9e6a10bd
Showing with 30 additions and 28 deletions.
  1. +30 −28 src/Command/Update/ExecuteCommand.php
@@ -133,10 +133,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
$updates = update_resolve_dependencies($start);
$dependencyMap = [];
$allowUpdate = false;
foreach ($updates as $function => $update) {
$dependencyMap[$function] = !empty($update['reverse_paths']) ? array_keys($update['reverse_paths']) : [];
}
if (!$this->checkUpdates($start, $updates)) {
if ($this->module === 'all') {
$this->getIo()->info(
@@ -158,30 +158,46 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$this->getIo()->info('');
} else {
$this->showUpdateTable($updates, $this->trans('commands.update.execute.messages.pending-updates'));
$updateList = update_get_update_list();
$this->showUpdateTable($this->module === 'all' ? $updateList: $updateList[$this->module], $this->trans('commands.update.execute.messages.pending-updates'));
$allowUpdate = $this->getIo()->confirm(
$this->trans('commands.update.execute.questions.update'),
true
);
}
// Handle Post update to execute
$allowPostUpdate = false;
if(!$postUpdates = $this->postUpdateRegistry->getPendingUpdateInformation()) {
$this->getIo()->info(
$this->trans('commands.update.execute.messages.no-pending-post-updates')
);
} else {
$this->showPostUpdateTable($postUpdates, $this->trans('commands.update.execute.messages.pending-post-updates'));
$allowPostUpdate = $this->getIo()->confirm(
$this->trans('commands.update.execute.questions.post-update'),
true
);
}
if($allowUpdate) {
try {
if($allowUpdate) {
$this->runUpdates(
$updates
);
}
$this->runUpdates(
$updates
);
} catch (\Exception $e) {
watchdog_exception('update', $e);
$this->getIo()->error($e->getMessage());
return 1;
}
}
// Post Updates are only safe to run after all schemas have been updated.
$postUpdates = $this->runPostUpdates();
if($allowPostUpdate) {
$this->runPostUpdates($postUpdates);
}
if($postUpdates || $allowUpdate) {
if($allowPostUpdate || $allowUpdate) {
$this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);
}
@@ -266,25 +282,12 @@ private function runUpdates(
}
/**
* @param array $postUpdates
* @return bool
*/
private function runPostUpdates()
private function runPostUpdates($postUpdates)
{
if(!$postUpdates = $this->postUpdateRegistry->getPendingUpdateInformation()) {
$this->getIo()->info(
$this->trans('commands.update.execute.messages.no-pending-post-updates')
);
return 0;
}
$this->showPostUpdateTable($postUpdates, $this->trans('commands.update.execute.messages.pending-post-updates'));
$allowPostUpdate = $this->getIo()->confirm(
$this->trans('commands.update.execute.questions.post-update'),
true
);
if(!$allowPostUpdate) {
if(!$postUpdates) {
return 0;
}
@@ -314,7 +317,7 @@ private function runPostUpdates()
$this->chainQueue->addCommand('update:entities');
return true;
return 1;
}
protected function getUpdates($module = null)
@@ -338,7 +341,6 @@ protected function getUpdateList()
{
$start = [];
$updates = update_get_update_list();
foreach ($updates as $module => $update) {
$start[$module] = $update['start'];
}

0 comments on commit ac553b7

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