mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
24ba880d11
MINOR Documentation for Task* classes git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@67018 467b73ca-7a2a-4603-9d3b-597d59a354a9
33 lines
881 B
PHP
Executable File
33 lines
881 B
PHP
Executable File
<?php
|
|
/**
|
|
* Base class invoked from CLI rather than the webserver (Cron jobs, handling email bounces).
|
|
* You can call subclasses of CliController directly, which will trigger a
|
|
* call to {@link process()} on every sub-subclass. For instance, calling
|
|
* "sake DailyTask" from the commandline will call {@link process()} on every subclass
|
|
* of DailyTask.
|
|
*
|
|
* @package sapphire
|
|
* @subpackage cron
|
|
*/
|
|
abstract class CliController extends Controller {
|
|
function init() {
|
|
$this->disableBasicAuth();
|
|
parent::init();
|
|
}
|
|
|
|
function index() {
|
|
foreach( ClassInfo::subclassesFor( $this->class ) as $subclass ) {
|
|
echo $subclass . "\n";
|
|
|
|
$task = new $subclass();
|
|
$task->init();
|
|
$task->process();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Overload this method to contain the task logic.
|
|
*/
|
|
function process() {}
|
|
}
|
|
?>
|