mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-08 20:46:05 +00:00
pass $user to execute() method of task
This commit is contained in:
parent
ff69d6e08e
commit
537327e41d
|
@ -186,7 +186,7 @@ class SeedDMS_ExtExample_Task extends SeedDMS_SchedulerTaskBase {
|
||||||
* @param $dms dms
|
* @param $dms dms
|
||||||
* @return boolean true if task was executed succesfully, otherwise false
|
* @return boolean true if task was executed succesfully, otherwise false
|
||||||
*/
|
*/
|
||||||
public function execute($task, $dms) {
|
public function execute($task, $dms, $user) {
|
||||||
$taskparams = $task->getParameter();
|
$taskparams = $task->getParameter();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* @package SeedDMS
|
* @package SeedDMS
|
||||||
*/
|
*/
|
||||||
class SeedDMS_SchedulerTaskBase {
|
class SeedDMS_SchedulerTaskBase {
|
||||||
public function execute($task, $dms) {
|
public function execute($task, $dms, $user) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,11 +73,16 @@ foreach($tasks as $task) {
|
||||||
case "run":
|
case "run":
|
||||||
if(method_exists($taskobj, 'execute')) {
|
if(method_exists($taskobj, 'execute')) {
|
||||||
if(!$task->getDisabled()) {
|
if(!$task->getDisabled()) {
|
||||||
if($taskobj->execute($task, $dms)) {
|
if($user = $dms->getUserByLogin('cli_scheduler')) {
|
||||||
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." successful.");
|
if($taskobj->execute($task, $dms, $user)) {
|
||||||
$task->updateLastNextRun();
|
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." successful.");
|
||||||
|
$task->updateLastNextRun();
|
||||||
|
} else {
|
||||||
|
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." failed, task has been disabled.", PEAR_LOG_ERR);
|
||||||
|
$task->setDisabled(1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." failed, task has been disabled.", PEAR_LOG_ERR);
|
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." failed because of missing user 'cli_scheduler'. Task has been disabled.", PEAR_LOG_ERR);
|
||||||
$task->setDisabled(1);
|
$task->setDisabled(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user