From da5a94c26d2d9f9a70f07c81a557706e30c6d5b5 Mon Sep 17 00:00:00 2001 From: Peter Jaap Blaakmeer Date: Thu, 28 Dec 2023 10:07:40 +0100 Subject: [PATCH] Add retrieving the cron expression from the config when a config path is set (#203) --- Helper/JobConfig.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Helper/JobConfig.php b/Helper/JobConfig.php index 0af611ec..066de1af 100644 --- a/Helper/JobConfig.php +++ b/Helper/JobConfig.php @@ -124,6 +124,9 @@ public function sanitizeJobConfig(array $job) $job['schedule'] = !empty($job['schedule']) ? $job['schedule'] : ''; $job['instance'] = !empty($job['instance']) ? $job['instance'] : ''; $job['method'] = !empty($job['method']) ? $job['method'] : ''; + if (isset($job['config_path'])) { + $job['schedule'] = $this->parseCronConfigPath($job); + } return $job; } @@ -148,4 +151,9 @@ public function validateFrequency(?string $frequency): void $schedule->matchCronExpression($expression, 0); } } + + public function parseCronConfigPath(array $job): string + { + return $this->scopeConfig->getValue($job['config_path']) ?? ''; + } }