summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-06-23 17:40:55 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-06-23 17:40:55 +0200
commit02b2b605810adcf8862a6b7548e1ed30bc56a2f6 (patch)
treebc485f1d99864fc078f140da19613276c8a7266d /core
parente01db549a04136f0ddee11245aa3a1b4e6381cca (diff)
parentc86e129ce90c65de92172676b3798a8b48589b58 (diff)
downloadnextcloud-server-02b2b605810adcf8862a6b7548e1ed30bc56a2f6.tar.gz
nextcloud-server-02b2b605810adcf8862a6b7548e1ed30bc56a2f6.zip
Merge pull request #17095 from owncloud/proper-error-handling
Proper error handling
Diffstat (limited to 'core')
-rw-r--r--core/command/upgrade.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/core/command/upgrade.php b/core/command/upgrade.php
index 58e98e2bbdc..cf376148a00 100644
--- a/core/command/upgrade.php
+++ b/core/command/upgrade.php
@@ -39,8 +39,7 @@ class Upgrade extends Command {
const ERROR_MAINTENANCE_MODE = 2;
const ERROR_UP_TO_DATE = 3;
const ERROR_INVALID_ARGUMENTS = 4;
-
- public $upgradeFailed = false;
+ const ERROR_FAILURE = 5;
/**
* @var IConfig
@@ -128,10 +127,11 @@ class Upgrade extends Command {
$output->writeln('<info>Maintenance mode is kept active</info>');
});
$updater->listen('\OC\Updater', 'updateEnd',
- function () use($output, $updateStepEnabled, $self) {
+ function ($success) use($output, $updateStepEnabled, $self) {
$mode = $updateStepEnabled ? 'Update' : 'Update simulation';
- $status = $self->upgradeFailed ? 'failed' : 'successful';
- $message = "<info>$mode $status</info>";
+ $status = $success ? 'successful' : 'failed' ;
+ $type = $success ? 'info' : 'error';
+ $message = "<$type>$mode $status</$type>";
$output->writeln($message);
});
$updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) {
@@ -166,13 +166,16 @@ class Upgrade extends Command {
});
$updater->listen('\OC\Updater', 'failure', function ($message) use($output, $self) {
$output->writeln("<error>$message</error>");
- $self->upgradeFailed = true;
});
- $updater->upgrade();
+ $success = $updater->upgrade();
$this->postUpgradeCheck($input, $output);
+ if(!$success) {
+ return self::ERROR_FAILURE;
+ }
+
return self::ERROR_SUCCESS;
} else if($this->config->getSystemValue('maintenance', false)) {
//Possible scenario: ownCloud core is updated but an app failed