ProcessSchedulerBaseCommand Class Reference
Run the next job in scheduler list. More...
Public Member Functions |
|
get_description () | |
Returns a description of this command.
|
|
get_name () | |
Returns title of command. |
|
Protected Member Functions |
|
do_execute () | |
Does processing. |
|
on_error ($task, $err) | |
Handle errors. |
|
on_success ($task, $err) | |
Handle success. |
|
run_task ($task) | |
Run a task. |
Detailed Description
Run the next job in scheduler list.
Definition at line 5 of file processscheduler.cmd.php.
Member Function Documentation
ProcessSchedulerBaseCommand::do_execute | ( | ) | [protected] |
Does processing.
Reimplemented from CommandChain.
Reimplemented in CleanupSchedulerBaseCommand.
Definition at line 9 of file processscheduler.cmd.php.
00009 { 00010 $ret = new Status(); 00011 $task = $this->get_params(); 00012 $err_task = $this->run_task($task); 00013 $this->append(CommandsFactory::create_command($task, 'reschedule', $err_task)); 00014 if ($err_task->is_error()) { 00015 $ret->merge($this->on_error($task, $err_task)); 00016 } 00017 else { 00018 $ret->merge($this->on_success($task, $err_task)); 00019 } 00020 return $ret; 00021 }
ProcessSchedulerBaseCommand::get_description | ( | ) |
Returns a description of this command.
Reimplemented from CommandBase.
Reimplemented in CleanupSchedulerBaseCommand.
Definition at line 33 of file processscheduler.cmd.php.
00033 { 00034 return tr('Process', 'scheduler'); 00035 }
ProcessSchedulerBaseCommand::get_name | ( | ) |
Returns title of command.
Reimplemented from CommandBase.
Reimplemented in CleanupSchedulerBaseCommand.
Definition at line 26 of file processscheduler.cmd.php.
ProcessSchedulerBaseCommand::on_error | ( | $ | task, | |
$ | err | |||
) | [protected] |
Handle errors.
- Parameters:
-
DAOScheduler $task Status $err
- Returns:
- Status
Definition at line 61 of file processscheduler.cmd.php.
00061 { 00062 $ret = new Status(); 00063 00064 if (Config::has_feature(ConfigScheduler::SEND_ERROR_MAIL)) { 00065 Load::commands('generics/mail'); 00066 $cmd_admin = new MailCommand( 00067 tr('Task "%t" failed', 'scheduler', array('%t' => $task->name)), 00068 Config::get_value(Config::MAIL_ADMIN), 00069 'scheduler/mail/error_admin', 00070 array( 00071 'error' => $err, 00072 'task' => $task 00073 ) 00074 ); 00075 $this->append($cmd_admin); 00076 } 00077 00078 return $ret; 00079 }
ProcessSchedulerBaseCommand::on_success | ( | $ | task, | |
$ | err | |||
) | [protected] |
Handle success.
- Parameters:
-
DAOScheduler $task Status $err
- Returns:
- Status
Definition at line 88 of file processscheduler.cmd.php.
00088 { 00089 $ret = new Status(); 00090 return $ret; 00091 }
ProcessSchedulerBaseCommand::run_task | ( | $ | task | ) | [protected] |
Run a task.
- Parameters:
-
DAOScheduler $task
- Returns:
- Status
Definition at line 43 of file processscheduler.cmd.php.
00043 { 00044 $ret = new Status(); 00045 if (empty($task)) { 00046 return $ret; 00047 } 00048 00049 Load::components('console'); 00050 $ret->merge(Console::invoke($task->action)); 00051 return $ret; 00052 }
The documentation for this class was generated from the following file:
- contributions/scheduler/behaviour/commands/base/processscheduler.cmd.php