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:
parent
481eb92b1a
commit
0c18e53201
10
cron.php
10
cron.php
|
@ -127,12 +127,18 @@ function run__cronjobs_filter_job($software, $instance, $filter, $action) {
|
||||||
$jobname = $action['action']['name'].'_'.$user['id'];
|
$jobname = $action['action']['name'].'_'.$user['id'];
|
||||||
$jobmod = 'api/v1/http/'.$software.'/accounts/'.$action['action']['name'];
|
$jobmod = 'api/v1/http/'.$software.'/accounts/'.$action['action']['name'];
|
||||||
$report = '[automatic_report] User has been reported because it matches filter "'.$filter['preset_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([
|
$args = base64_encode(json_encode([
|
||||||
'_get' => [
|
'_get' => [
|
||||||
'id' => $user['id'],
|
'id' => $user['id'],
|
||||||
'instance' => $instance,
|
'instance' => $instance,
|
||||||
],
|
],
|
||||||
'_post' => ['report' => $report ],
|
'_post' => [
|
||||||
|
'report' => $report,
|
||||||
|
'explain' => $explain,
|
||||||
|
],
|
||||||
]));
|
]));
|
||||||
$_POST = [
|
$_POST = [
|
||||||
'name' => $jobname,
|
'name' => $jobname,
|
||||||
|
@ -187,6 +193,8 @@ function run_cronjobs() {
|
||||||
$max = 1000;
|
$max = 1000;
|
||||||
if (isset($GLOBALS['appconf']['cron__max_jobs']))
|
if (isset($GLOBALS['appconf']['cron__max_jobs']))
|
||||||
$max = intval($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];
|
$_GET = ['max' => $max];
|
||||||
$jobs = mod_php('api/v1/cron/jobs');
|
$jobs = mod_php('api/v1/cron/jobs');
|
||||||
foreach ($jobs as $job) {
|
foreach ($jobs as $job) {
|
||||||
|
|
Loading…
Reference in New Issue