]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(cron.php): Avoid pulling configuration twice 43454/head
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 8 Feb 2024 13:38:03 +0000 (14:38 +0100)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 8 Feb 2024 13:38:03 +0000 (14:38 +0100)
IConfig is a small wrapper around SystemConfig, no need to pull both of them

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
cron.php

index e599f460c13afb7b99f025f3c98c5c9c6c177e51..4e95481deb624cc39be482465810132f65caf10f 100644 (file)
--- a/cron.php
+++ b/cron.php
@@ -44,7 +44,6 @@ declare(strict_types=1);
 
 require_once __DIR__ . '/lib/versioncheck.php';
 
-use OC\SystemConfig;
 use OCP\App\IAppManager;
 use OCP\BackgroundJob\IJobList;
 use OCP\IAppConfig;
@@ -62,13 +61,14 @@ try {
                Server::get(LoggerInterface::class)->debug('Update required, skipping cron', ['app' => 'cron']);
                exit;
        }
-       if ((bool) Server::get(SystemConfig::class)->getValue('maintenance', false)) {
+
+       $config = Server::get(IConfig::class);
+
+       if ($config->getSystemValueBool('maintenance', false)) {
                Server::get(LoggerInterface::class)->debug('We are in maintenance mode, skipping cron', ['app' => 'cron']);
                exit;
        }
 
-       $config = Server::get(IConfig::class);
-
        // Don't do anything if Nextcloud has not been installed
        if (!$config->getSystemValueBool('installed', false)) {
                exit(0);