* @return bool
*/
public function checkMaintenanceMode() {
- if ($this->config->getSystemValue('maintenance', false)) {
+ if ($this->config->getSystemValueBool('maintenance')) {
throw new ServiceUnavailable('System in maintenance mode.');
}
if (Util::needUpgrade()) {
* register hooks
*/
public function registerHooks() {
- if (!$this->config->getSystemValue('maintenance', false)) {
+ if (!$this->config->getSystemValueBool('maintenance')) {
$container = $this->getContainer();
$server = $container->getServer();
*/
protected function forceMaintenanceAndTrashbin() {
$this->wasTrashbinEnabled = $this->appManager->isEnabledForUser('files_trashbin');
- $this->wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
+ $this->wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance');
$this->config->setSystemValue('maintenance', true);
$this->appManager->disableApp('files_trashbin');
}
*/
protected function forceMaintenanceAndTrashbin() {
$this->wasTrashbinEnabled = $this->appManager->isEnabledForUser('files_trashbin');
- $this->wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
+ $this->wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance');
$this->config->setSystemValue('maintenance', true);
$this->appManager->disableApp('files_trashbin');
}
}
protected function execute(InputInterface $input, OutputInterface $output) {
- $maintenanceMode = $this->config->getSystemValue('maintenance', false);
+ $maintenanceMode = $this->config->getSystemValueBool('maintenance');
if ($input->getOption('on')) {
if ($maintenanceMode === false) {
$this->config->setSystemValue('maintenance', true);
}
}
- $maintenanceMode = $this->config->getSystemValue('maintenance', false);
+ $maintenanceMode = $this->config->getSystemValueBool('maintenance');
$this->config->setSystemValue('maintenance', true);
$this->progress = new ProgressBar($output);
$dispatcher->addListener('\OC\Repair::info', $repairListener);
$dispatcher->addListener('\OC\Repair::warning', $repairListener);
$dispatcher->addListener('\OC\Repair::error', $repairListener);
-
+
$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use($output) {
$output->writeln('<info>Turned on maintenance mode</info>');
}
return self::ERROR_SUCCESS;
- } else if($this->config->getSystemValue('maintenance', false)) {
+ } else if($this->config->getSystemValueBool('maintenance')) {
//Possible scenario: Nextcloud core is updated but an app failed
$output->writeln('<warning>Nextcloud is in maintenance mode</warning>');
$output->write('<comment>Maybe an upgrade is already in process. Please check the '
\OC::$server->getLogger()->debug('Update required, skipping cron', ['app' => 'cron']);
exit;
}
- if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) {
+ if ((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
\OC::$server->getLogger()->debug('We are in maintenance mode, skipping cron', ['app' => 'cron']);
exit;
}
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');
if (function_exists('opcache_reset')) {
opcache_reset();
}
- if (!$systemConfig->getValue('maintenance', false)) {
+ if (!((bool) $systemConfig->getValue('maintenance', false))) {
self::printUpgradePage($systemConfig);
exit();
}
// 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();
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();
}
$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
)
);
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();
$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');
$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);
}
}
-
* 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
require_once __DIR__ . '/../lib/base.php';
if (\OCP\Util::needUpgrade()
- || \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
+ || \OC::$server->getConfig()->getSystemValueBool('maintenance')) {
// since the behavior of apps or remotes are unpredictable during
// an upgrade, return a 503 directly
http_response_code(503);
.' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
}
-