Feature #31073 ยป scheduler_cli_dispatch.diff
scheduler_cli_dispatch.php 2011-10-18 14:56:22.080426996 +0200 | ||
---|---|---|
* @var tx_scheduler
|
||
*/
|
||
$scheduler = t3lib_div::makeInstance('tx_scheduler');
|
||
$cli = t3lib_div::makeInstance('t3lib_cli');
|
||
// If a specific id is given in arguments, then run that task. Otherwise run scheduled tasks.
|
||
if($cli->cli_argValue("-i") > 0){
|
||
$taskId = $cli->cli_argValue("-i");
|
||
$task = $scheduler->fetchTask($taskId);
|
||
$scheduler->executeTask($task);
|
||
// Record the run in the system registry
|
||
$scheduler->recordLastRun('manual');
|
||
} else {
|
||
// Loop as long as there are tasks
|
||
do {
|
||
// Try getting the next task and execute it
|
||
... | ... | |
} while ($hasTask);
|
||
// Record the run in the system registry
|
||
$scheduler->recordLastRun();
|
||
}
|
||
} else {
|
||
die('This script must be included by the "CLI module dispatcher"');
|
||
}
|