diff options
author | Joas Schilling <coding@schilljs.com> | 2019-02-06 17:08:41 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-02-22 08:25:41 +0100 |
commit | 0c77cd21f94dd9922e0e04ec4c7e99eff9376e07 (patch) | |
tree | a9c413768e4de0b393b44bd2d49f1a4cfeb7b782 /lib | |
parent | a11ef5134cb4200399e74811bbf9d1100923efcd (diff) | |
download | nextcloud-server-0c77cd21f94dd9922e0e04ec4c7e99eff9376e07.tar.gz nextcloud-server-0c77cd21f94dd9922e0e04ec4c7e99eff9376e07.zip |
Make sure maintenance mode is always casted to bool
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 8 | ||||
-rw-r--r-- | lib/private/Console/Application.php | 10 | ||||
-rw-r--r-- | lib/private/Route/Router.php | 2 | ||||
-rw-r--r-- | lib/private/Updater.php | 3 | ||||
-rw-r--r-- | lib/private/legacy/app.php | 2 |
5 files changed, 12 insertions, 13 deletions
diff --git a/lib/base.php b/lib/base.php index 90fa5496200..d5149fc0449 100644 --- a/lib/base.php +++ b/lib/base.php @@ -285,7 +285,7 @@ class OC { public static function checkMaintenanceMode() { // Allow ajax update script to execute without being stopped - if (\OC::$server->getSystemConfig()->getValue('maintenance', false) && OC::$SUBURI != '/core/ajax/update.php') { + if (((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) && OC::$SUBURI != '/core/ajax/update.php') { // send http status 503 http_response_code(503); header('Retry-After: 120'); @@ -938,7 +938,7 @@ class OC { if (function_exists('opcache_reset')) { opcache_reset(); } - if (!$systemConfig->getValue('maintenance', false)) { + if (!((bool) $systemConfig->getValue('maintenance', false))) { self::printUpgradePage($systemConfig); exit(); } @@ -966,7 +966,7 @@ class OC { // Load minimum set of apps if (!\OCP\Util::needUpgrade() - && !$systemConfig->getValue('maintenance', false)) { + && !((bool) $systemConfig->getValue('maintenance', false))) { // For logged-in users: Load everything if(\OC::$server->getUserSession()->isLoggedIn()) { OC_App::loadApps(); @@ -979,7 +979,7 @@ class OC { if (!self::$CLI) { try { - if (!$systemConfig->getValue('maintenance', false) && !\OCP\Util::needUpgrade()) { + if (!((bool) $systemConfig->getValue('maintenance', false)) && !\OCP\Util::needUpgrade()) { OC_App::loadApps(array('filesystem', 'logging')); OC_App::loadApps(); } diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 0e30fa02b94..d7c047527f1 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -91,10 +91,10 @@ class Application { $inputDefinition = $application->getDefinition(); $inputDefinition->addOption( new InputOption( - 'no-warnings', - null, - InputOption::VALUE_NONE, - 'Skip global warnings, show command output only', + 'no-warnings', + null, + InputOption::VALUE_NONE, + 'Skip global warnings, show command output only', null ) ); @@ -119,7 +119,7 @@ class Application { if ($this->config->getSystemValue('installed', false)) { if (\OCP\Util::needUpgrade()) { throw new NeedsUpdateException(); - } elseif ($this->config->getSystemValue('maintenance', false)) { + } elseif ($this->config->getSystemValueBool('maintenance')) { $this->writeMaintenanceModeInfo($input, $output); } else { OC_App::loadApps(); diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index b44b3f7c2ce..1839b356424 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -260,7 +260,7 @@ class Router implements IRouter { $this->loadRoutes($app); } else if (substr($url, 0, 6) === '/core/' or substr($url, 0, 10) === '/settings/') { \OC::$REQUESTEDAPP = $url; - if (!\OC::$server->getConfig()->getSystemValue('maintenance', false) && !Util::needUpgrade()) { + if (!\OC::$server->getConfig()->getSystemValueBool('maintenance') && !Util::needUpgrade()) { \OC_App::loadApps(); } $this->loadRoutes('core'); diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 4b4723be94f..313cfc82ffa 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -104,7 +104,7 @@ class Updater extends BasicEmitter { $this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); $this->config->setSystemValue('loglevel', ILogger::DEBUG); - $wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); + $wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance'); if(!$wasMaintenanceModeEnabled) { $this->config->setSystemValue('maintenance', true); @@ -614,4 +614,3 @@ class Updater extends BasicEmitter { } } - diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 4cab92eba64..9b4a83de349 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -106,7 +106,7 @@ class OC_App { * if $types is set to non-empty array, only apps of those types will be loaded */ public static function loadApps(array $types = []): bool { - if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) { + if ((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) { return false; } // Load the enabled apps here |