diff options
author | diosmosis <benaka@piwik.pro> | 2015-03-15 21:07:34 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-03-15 21:07:34 +0300 |
commit | 3eb8b437be9fa64849677e08ee7a0844acd076ed (patch) | |
tree | b8bf19626f10b814dde28bd33f92022e593ac229 /plugins | |
parent | 488435fa19e63306547fc1a8586b31eea668d555 (diff) |
Clean up update command output when errors occur during the update process.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreUpdater/Commands/Update.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/plugins/CoreUpdater/Commands/Update.php b/plugins/CoreUpdater/Commands/Update.php index 7250395cf4..07d12cada3 100644 --- a/plugins/CoreUpdater/Commands/Update.php +++ b/plugins/CoreUpdater/Commands/Update.php @@ -71,10 +71,6 @@ class Update extends ConsoleCommand } catch(NoUpdatesFoundException $e) { // Do not fail if no updates were found $this->writeSuccessMessage($output, array($e->getMessage())); - } catch (\Exception $e) { - // Fail in case of any other error during upgrade - $output->writeln("<error>" . $e->getMessage() . "</error>"); - throw $e; } } @@ -203,11 +199,15 @@ class Update extends ConsoleCommand } $output->writeln(array( + "", " [X] " . Piwik::translate('CoreUpdater_CriticalErrorDuringTheUpgradeProcess'), "", )); foreach ($errors as $errorMessage) { + $errorMessage = trim($errorMessage); + $errorMessage = str_replace("\n", "\n ", $errorMessage); + $output->writeln(" * $errorMessage"); } @@ -220,14 +220,18 @@ class Update extends ConsoleCommand if ($includeDiyHelp) { $output->writeln(array( + "", " " . Piwik::translate('CoreUpdater_ErrorDIYHelp'), - "* " . Piwik::translate('CoreUpdater_ErrorDIYHelp_1'), - "* " . Piwik::translate('CoreUpdater_ErrorDIYHelp_2'), - "* " . Piwik::translate('CoreUpdater_ErrorDIYHelp_3'), - "* " . Piwik::translate('CoreUpdater_ErrorDIYHelp_4'), - "* " . Piwik::translate('CoreUpdater_ErrorDIYHelp_5') + "", + " * " . Piwik::translate('CoreUpdater_ErrorDIYHelp_1'), + " * " . Piwik::translate('CoreUpdater_ErrorDIYHelp_2'), + " * " . Piwik::translate('CoreUpdater_ErrorDIYHelp_3'), + " * " . Piwik::translate('CoreUpdater_ErrorDIYHelp_4'), + " * " . Piwik::translate('CoreUpdater_ErrorDIYHelp_5') )); } + + throw new \RuntimeException("Piwik could not be updated! See above for more information."); } private function outputUpdaterWarnings(OutputInterface $output, $warnings) @@ -265,7 +269,7 @@ class Update extends ConsoleCommand private function getUpdateHelpMessage() { - return Piwik::translate('CoreUpdater_HelpMessageContent', array('[',']','\n\n *')); + return Piwik::translate('CoreUpdater_HelpMessageContent', array('[',']',"\n *")); } private function isUpdatingCore($componentsWithUpdateFile) |