diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-05-19 11:27:53 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-05-19 11:56:04 +0300 |
commit | 064f5204cc365bcf8c12ef34e6fde92175c9d6fa (patch) | |
tree | 1c20230351041b74bc131ab05826ef0cdcb6c97e /lib/private/updater.php | |
parent | aae9274210ad80e3c313d55999684c03f6e06b2c (diff) |
Persist the state of the maintenance after an upgrade
* if maintenance mode was enabled before an upgrade
it will be enabled afterwards too
* fixes #16429
Diffstat (limited to 'lib/private/updater.php')
-rw-r--r-- | lib/private/updater.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/updater.php b/lib/private/updater.php index 59b1c0a8f66..3299bc1de83 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -163,14 +163,18 @@ class Updater extends BasicEmitter { * @return bool true if the operation succeeded, false otherwise */ public function upgrade() { - $this->config->setSystemValue('maintenance', true); + $wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); + + if(!$wasMaintenanceModeEnabled) { + $this->config->setSystemValue('maintenance', true); + $this->emit('\OC\Updater', 'maintenanceEnabled'); + } $installedVersion = $this->config->getSystemValue('version', '0.0.0'); $currentVersion = implode('.', \OC_Util::getVersion()); if ($this->log) { $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core')); } - $this->emit('\OC\Updater', 'maintenanceStart'); try { $this->doUpgrade($currentVersion, $installedVersion); @@ -178,8 +182,14 @@ class Updater extends BasicEmitter { $this->emit('\OC\Updater', 'failure', array($exception->getMessage())); } - $this->config->setSystemValue('maintenance', false); - $this->emit('\OC\Updater', 'maintenanceEnd'); + $this->emit('\OC\Updater', 'updateEnd'); + + if(!$wasMaintenanceModeEnabled) { + $this->config->setSystemValue('maintenance', false); + $this->emit('\OC\Updater', 'maintenanceDisabled'); + } else { + $this->emit('\OC\Updater', 'maintenanceActive'); + } } /** |