Skip to content

Commit da5a94c

Browse files
authored
Add retrieving the cron expression from the config when a config path is set (#203)
1 parent 455b34c commit da5a94c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Helper/JobConfig.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ public function sanitizeJobConfig(array $job)
124124
$job['schedule'] = !empty($job['schedule']) ? $job['schedule'] : '';
125125
$job['instance'] = !empty($job['instance']) ? $job['instance'] : '';
126126
$job['method'] = !empty($job['method']) ? $job['method'] : '';
127+
if (isset($job['config_path'])) {
128+
$job['schedule'] = $this->parseCronConfigPath($job);
129+
}
127130
return $job;
128131
}
129132

@@ -148,4 +151,9 @@ public function validateFrequency(?string $frequency): void
148151
$schedule->matchCronExpression($expression, 0);
149152
}
150153
}
154+
155+
public function parseCronConfigPath(array $job): string
156+
{
157+
return $this->scopeConfig->getValue($job['config_path']) ?? '';
158+
}
151159
}

0 commit comments

Comments
 (0)