aboutsummaryrefslogtreecommitdiffstats
path: root/cron.php
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2024-04-11 10:55:39 +0200
committerJulien Veyssier <julien-nc@posteo.net>2024-05-02 16:43:42 +0200
commit0eb4cddc54c3b499c901bdd806b7b2aaeb5060e2 (patch)
tree13173812489014f7974dd6da9e30f1bdeb526d4a /cron.php
parentd967151f520ba6c860ed9a727e3363ec04a6506d (diff)
downloadnextcloud-server-0eb4cddc54c3b499c901bdd806b7b2aaeb5060e2.tar.gz
nextcloud-server-0eb4cddc54c3b499c901bdd806b7b2aaeb5060e2.zip
feat(bg-jobs): support multiple arguments in cron.php and occ:background-job:worker for the job class list
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'cron.php')
-rw-r--r--cron.php18
1 files changed, 6 insertions, 12 deletions
diff --git a/cron.php b/cron.php
index d0a8b770dfc..9b0489653ef 100644
--- a/cron.php
+++ b/cron.php
@@ -62,10 +62,10 @@ try {
Run the background job routine
Usage:
- php -f cron.php -- [-h] [<job-classes>]
+ php -f cron.php -- [-h] [<job-classes>...]
Arguments:
- job-classes Optional job class comma-separated list to only run those jobs
+ job-classes Optional job class list to only run those jobs
Options:
-h, --help Display this help message' . PHP_EOL;
@@ -175,16 +175,10 @@ Options:
$endTime = time() + 14 * 60;
$executedJobs = [];
- // a specific job class list can optionally be given as first argument
- // only keep non-empty strings
- $jobClasses = isset($argv[1])
- ? array_filter(
- explode(',', $argv[1]),
- static function (string $jobClass) {
- return strlen($jobClass) > 0;
- }
- )
- : null;
+ // a specific job class list can optionally be given as argument
+ $jobClasses = array_slice($argv, 1);
+ $jobClasses = empty($jobClasses) ? null : $jobClasses;
+
while ($job = $jobList->getNext($onlyTimeSensitive, $jobClasses)) {
if (isset($executedJobs[$job->getId()])) {
$jobList->unlockJob($job);