From 65d013b9aefc2e8c5ae3d1f4c02368f79201e209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 8 Feb 2024 14:16:44 +0100 Subject: [PATCH] fix(cron.php): Use new IAppConfig interface in cron.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- cron.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cron.php b/cron.php index 428158f629d..1624dcdd6d0 100644 --- a/cron.php +++ b/cron.php @@ -46,6 +46,7 @@ require_once __DIR__ . '/lib/versioncheck.php'; use OC\SystemConfig; use OCP\BackgroundJob\IJobList; +use OCP\IAppConfig; use OCP\IConfig; use OCP\ISession; use OCP\ITempManager; @@ -78,6 +79,7 @@ try { $logger = Server::get(LoggerInterface::class); $config = Server::get(IConfig::class); + $appConfig = Server::get(IAppConfig::class); $tempManager = Server::get(ITempManager::class); // Don't do anything if Nextcloud has not been installed @@ -88,7 +90,7 @@ try { $tempManager->cleanOld(); // Exit if background jobs are disabled! - $appMode = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax'); + $appMode = $appConfig->getValueString('core', 'backgroundjobs_mode', 'ajax'); if ($appMode === 'none') { if (OC::$CLI) { echo 'Background Jobs are disabled!' . PHP_EOL; @@ -122,7 +124,7 @@ try { // We call Nextcloud from the CLI (aka cron) if ($appMode !== 'cron') { - $config->setAppValue('core', 'backgroundjobs_mode', 'cron'); + $appConfig->setValueString('core', 'backgroundjobs_mode', 'cron'); } // Low-load hours @@ -211,7 +213,7 @@ try { } // Log the successful cron execution - $config->setAppValue('core', 'lastcron', time()); + $appConfig->setValueInt('core', 'lastcron', time()); exit(); } catch (Exception $ex) { Server::get(LoggerInterface::class)->error(