Skip to content

Commit f7c77d1

Browse files
committed
fix for cron force running
Signed-off-by: Andy Miller <[email protected]>
1 parent 0fd734c commit f7c77d1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@
8787
"ext-exif": "Needed to use exif data from images."
8888
},
8989
"config": {
90-
"apcu-autoloader": true,
91-
"platform": {
92-
"php": "7.3.6"
93-
}
90+
"apcu-autoloader": true
9491
},
9592
"autoload": {
9693
"psr-4": {

system/src/Grav/Console/Cli/SchedulerCommand.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ protected function configure(): void
5757
'Force run all jobs or a specific job if you specify a specific Job ID',
5858
false
5959
)
60+
->addOption(
61+
'force',
62+
'f',
63+
InputOption::VALUE_NONE,
64+
'Force all due jobs to run regardless of their schedule'
65+
)
6066
->setDescription('Run the Grav Scheduler. Best when integrated with system cron')
61-
->setHelp("Running without any options will force the Scheduler to run through it's jobs and process them");
67+
->setHelp("Running without any options will process the Scheduler jobs based on their cron schedule. Use --force to run all jobs immediately.");
6268
}
6369

6470
/**
@@ -84,6 +90,7 @@ protected function serve(): int
8490
$run = $input->getOption('run');
8591
$showDetails = $input->getOption('details');
8692
$showJobs = $input->getOption('jobs');
93+
$forceRun = $input->getOption('force');
8794

8895
// Handle running jobs first if -r flag is present
8996
if ($run !== false) {
@@ -256,7 +263,7 @@ protected function serve(): int
256263
}
257264
} elseif (!$showJobs && !$showDetails && $run === false) {
258265
// Run scheduler only if no other options were provided
259-
$scheduler->run(null, true);
266+
$scheduler->run(null, $forceRun);
260267

261268
if ($input->getOption('verbose')) {
262269
$io->title('Running Scheduled Jobs');

0 commit comments

Comments
 (0)