diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2021-12-06 15:48:12 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2021-12-06 15:48:12 +0300 |
commit | fc196cc1d43680d88f987457b7f754baed7158d5 (patch) | |
tree | 48ce4bd49e65dc787e06dfc9dc9a3e3a2be3069e /lib | |
parent | 91f8fe8f9e9ea3c7bb1eb1b774f44ab6f519c3d2 (diff) |
+cron_enabled
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Cron/Backup.php | 2 | ||||
-rw-r--r-- | lib/Service/ConfigService.php | 6 | ||||
-rw-r--r-- | lib/Service/CronService.php | 6 |
3 files changed, 13 insertions, 1 deletions
diff --git a/lib/Cron/Backup.php b/lib/Cron/Backup.php index 1c14f87..7485177 100644 --- a/lib/Cron/Backup.php +++ b/lib/Cron/Backup.php @@ -74,7 +74,7 @@ class Backup extends TimedJob { ConfigService $configService, LoggerInterface $loggerInterface ) { - $this->setInterval(900); + $this->setInterval(9); $this->pointService = $pointService; $this->cronService = $cronService; diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index a113ad4..2b84aa1 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -48,6 +48,7 @@ class ConfigService { public const DATA_DIRECTORY = 'datadirectory'; public const LOGFILE = 'logfile'; + public const CRON_ENABLED = 'cron_enabled'; public const LOCK = 'lock'; public const REMOTE_ENABLED = 'remote_enabled'; public const EXTERNAL_APPDATA = 'external_appdata'; @@ -82,6 +83,7 @@ class ConfigService { /** @var array */ public $defaults = [ + self::CRON_ENABLED => 1, self::LOCK => 0, self::REMOTE_ENABLED => 0, self::EXTERNAL_APPDATA => '{}', @@ -370,6 +372,7 @@ class ConfigService { */ public function getSettings(): array { return [ + self::CRON_ENABLED => $this->getAppValueBool(self::CRON_ENABLED), self::DATE_FULL_RP => $this->getAppValueInt(self::DATE_FULL_RP), self::DATE_PARTIAL_RP => $this->getAppValueInt(self::DATE_PARTIAL_RP), self::TIME_SLOTS => $this->getAppValue(self::TIME_SLOTS), @@ -394,6 +397,9 @@ class ConfigService { public function setSettings(array $settings): array { $data = new SimpleDataStore($settings); + if ($data->hasKey(self::CRON_ENABLED)) { + $this->setAppValueBool(self::CRON_ENABLED, $data->gBool(self::CRON_ENABLED)); + } if ($data->hasKey(self::TIME_SLOTS)) { $this->setAppValue(self::TIME_SLOTS, $data->g(self::TIME_SLOTS)); } diff --git a/lib/Service/CronService.php b/lib/Service/CronService.php index 9eac87d..56ae36f 100644 --- a/lib/Service/CronService.php +++ b/lib/Service/CronService.php @@ -407,6 +407,12 @@ class CronService { public function isRealCron(): bool { $mode = $this->configService->getCoreValue('backgroundjobs_mode', ''); + if (!$this->configService->getAppValueBool(ConfigService::CRON_ENABLED)) { + return false; + } + + $this->configService->setAppValueBool(ConfigService::CRON_ENABLED, true); + return (strtolower($mode) === 'cron' || strtolower($mode) === 'webcron'); } } |