Skip to content

Commit

Permalink
Add retrieving the cron expression from the config when a config path…
Browse files Browse the repository at this point in the history
… is set (#203)
  • Loading branch information
peterjaap authored Dec 28, 2023
1 parent 455b34c commit da5a94c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Helper/JobConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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']) ?? '';
}
}

0 comments on commit da5a94c

Please sign in to comment.