summaryrefslogtreecommitdiffstats
path: root/lib/private/updater.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-06-03 13:56:17 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-06-03 13:56:17 +0200
commit739c3f01aa32a4de6f671f72fc9cc216d02972d2 (patch)
treed0822b073d4170c517558624d1b739be78b25927 /lib/private/updater.php
parent69d1e7aaf4ddb85fefa17cb7bd3c57274cc428f4 (diff)
parent064f5204cc365bcf8c12ef34e6fde92175c9d6fa (diff)
downloadnextcloud-server-739c3f01aa32a4de6f671f72fc9cc216d02972d2.tar.gz
nextcloud-server-739c3f01aa32a4de6f671f72fc9cc216d02972d2.zip
Merge pull request #16434 from owncloud/persist-maintenance-state
Persist the state of the maintenance after an upgrade
Diffstat (limited to 'lib/private/updater.php')
-rw-r--r--lib/private/updater.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 8371193ef79..7f1a493d2a0 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -176,14 +176,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);
@@ -191,8 +195,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');
+ }
}
/**