Add MAX_JOBS as an env variable too (in cron.php)

* Make "explain" field be added in the cron.php system
This commit is contained in:
Bofh 2022-12-09 00:37:03 +01:00
parent 481eb92b1a
commit 0c18e53201
1 changed files with 9 additions and 1 deletions

View File

@ -127,12 +127,18 @@ function run__cronjobs_filter_job($software, $instance, $filter, $action) {
$jobname = $action['action']['name'].'_'.$user['id'];
$jobmod = 'api/v1/http/'.$software.'/accounts/'.$action['action']['name'];
$report = '[automatic_report] User has been reported because it matches filter "'.$filter['preset_name'].'"';
$explain = $report;
if (isset($action['action']['explain']))
$explain = $action['action']['explain'];
$args = base64_encode(json_encode([
'_get' => [
'id' => $user['id'],
'instance' => $instance,
],
'_post' => ['report' => $report ],
'_post' => [
'report' => $report,
'explain' => $explain,
],
]));
$_POST = [
'name' => $jobname,
@ -187,6 +193,8 @@ function run_cronjobs() {
$max = 1000;
if (isset($GLOBALS['appconf']['cron__max_jobs']))
$max = intval($GLOBALS['appconf']['cron__max_jobs']);
if (getenv('MAX_JOBS') !== false)
$max = intval(getenv('MAX_JOBS'));
$_GET = ['max' => $max];
$jobs = mod_php('api/v1/cron/jobs');
foreach ($jobs as $job) {