summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-06-23 10:03:27 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-06-23 10:03:27 +0200
commitfe42553e8a034ca246698144b03dc4570fe0b826 (patch)
treeee1d3ee632a795f46c598364b3f3271056fd0266 /core
parentfdd01cf15c8ef59bc4da41ed3a1dc9e60ce5124e (diff)
downloadnextcloud-server-fe42553e8a034ca246698144b03dc4570fe0b826.tar.gz
nextcloud-server-fe42553e8a034ca246698144b03dc4570fe0b826.zip
[updater] propagate error case properly
* add $success to the updateEnd hook * add new return code for a update failure * add exception class to failure hook message
Diffstat (limited to 'core')
-rw-r--r--core/command/upgrade.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/command/upgrade.php b/core/command/upgrade.php
index 2d6394fea85..6791d386b27 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,9 +127,9 @@ 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';
+ $status = $success ? 'successful' : 'failed' ;
$message = "<info>$mode $status</info>";
$output->writeln($message);
});
@@ -163,13 +162,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