mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +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
|
||||
* @return boolean true if task was executed succesfully, otherwise false
|
||||
*/
|
||||
public function execute($task, $dms) {
|
||||
public function execute($task, $dms, $user) {
|
||||
$taskparams = $task->getParameter();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* @package SeedDMS
|
||||
*/
|
||||
class SeedDMS_SchedulerTaskBase {
|
||||
public function execute($task, $dms) {
|
||||
public function execute($task, $dms, $user) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,11 +73,16 @@ foreach($tasks as $task) {
|
|||
case "run":
|
||||
if(method_exists($taskobj, 'execute')) {
|
||||
if(!$task->getDisabled()) {
|
||||
if($taskobj->execute($task, $dms)) {
|
||||
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." successful.");
|
||||
$task->updateLastNextRun();
|
||||
if($user = $dms->getUserByLogin('cli_scheduler')) {
|
||||
if($taskobj->execute($task, $dms, $user)) {
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user