task to run can be passed in url

This commit is contained in:
Uwe Steinmann 2024-05-29 20:02:28 +02:00
parent ae72faab11
commit 8039a0f479
2 changed files with 7 additions and 0 deletions

View File

@ -28,6 +28,7 @@ class SeedDMS_Controller_Cron extends SeedDMS_Controller_Common {
$settings = $this->params['settings'];
$logger = $this->params['logger'];
$mode = $this->params['mode'];
$seltask = $this->params['task'];
$db = $dms->getDb();
$scheduler = new SeedDMS_Scheduler($db);
@ -35,6 +36,8 @@ class SeedDMS_Controller_Cron extends SeedDMS_Controller_Common {
$jsonarr = [];
foreach($tasks as $task) {
if($seltask && $seltask != $task->getExtension()."::".$task->getTask())
continue;
if(isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()]) && is_object($taskobj = resolveTask($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()][$task->getTask()]))) {
$arr = array(
'extension'=>$task->getExtension(),

View File

@ -42,10 +42,14 @@ if($user->getLogin() != 'cli_scheduler') {
$mode = 'list';
if(!empty($_GET['mode']) && in_array($_GET['mode'], array('list', 'run', 'dryrun', 'check')))
$mode = $_GET['mode'];
$task = '';
if(!empty($_GET['task']))
$task = $_GET['task'];
$controller->setParam('settings', $settings);
$controller->setParam('logger', $logger);
$controller->setParam('mode', $mode);
$controller->setParam('task', $task);
if(!$controller->run()) {
echo getMLText("error_occured");
exit;