26 lines
475 B
PHP
26 lines
475 B
PHP
<?php
|
|
|
|
$_ = function() {
|
|
$max = 1000;
|
|
if (isset($_GET['max']))
|
|
$max = intval(trim($_GET['max']));
|
|
if ($max <= 0)
|
|
return apiresult(['error' => '<max> parameter cannot be lower than zero']);
|
|
|
|
if (!filedb_exists('cron/jobs'))
|
|
return apiresult([]);
|
|
|
|
$i = -1;
|
|
$ids = [];
|
|
foreach (scandir(filedb_getdir('cron/jobs')) as $jobf) {
|
|
if (in_array($jobf, ['.','..']))
|
|
continue;
|
|
$i++;
|
|
if ($i >= $max)
|
|
break;
|
|
$ids []= $jobf;
|
|
}
|
|
return apiresult($ids);
|
|
};
|
|
$_();
|