diff --git a/cli/CliController.php b/cli/CliController.php index 4ebeb172b..7c3758b98 100755 --- a/cli/CliController.php +++ b/cli/CliController.php @@ -10,26 +10,27 @@ * @subpackage cron */ abstract class CliController extends Controller { - function init() { + + function init() { parent::init(); // Unless called from the command line, all CliControllers need ADMIN privileges - if(!Director::is_cli() && !Permission::check("ADMIN")) return Security::permissionFailure(); - } - - function index() { - foreach( ClassInfo::subclassesFor( $this->class ) as $subclass ) { - echo $subclass . "\n"; - - $task = new $subclass(); + if(!Director::is_cli() && !Permission::check("ADMIN")) { + return Security::permissionFailure(); + } + } + + function index() { + foreach(ClassInfo::subclassesFor($this->class) as $subclass) { + echo $subclass . "\n"; + $task = new $subclass(); $task->init(); - $task->process(); - } - } - + $task->process(); + } + } + /** * Overload this method to contain the task logic. */ - function process() {} -} + function process() {} -?> +} \ No newline at end of file diff --git a/tasks/DailyTask.php b/tasks/DailyTask.php index 05803fc8b..805dba2c5 100755 --- a/tasks/DailyTask.php +++ b/tasks/DailyTask.php @@ -11,6 +11,5 @@ * @subpackage cron */ class DailyTask extends ScheduledTask { - -} -?> \ No newline at end of file + +} \ No newline at end of file diff --git a/tasks/HourlyTask.php b/tasks/HourlyTask.php index 0f9d704cd..8bd8a2424 100644 --- a/tasks/HourlyTask.php +++ b/tasks/HourlyTask.php @@ -11,5 +11,4 @@ */ class HourlyTask extends ScheduledTask { -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/tasks/ScheduledTask.php b/tasks/ScheduledTask.php index 4d49ca3c0..5346a5c84 100755 --- a/tasks/ScheduledTask.php +++ b/tasks/ScheduledTask.php @@ -25,6 +25,5 @@ * @subpackage cron */ abstract class ScheduledTask extends CliController { - // this class exists as a logical extension -} -?> \ No newline at end of file + // this class exists as a logical extension +} \ No newline at end of file diff --git a/tasks/WeeklyTask.php b/tasks/WeeklyTask.php index bcfe56b73..47ca5d147 100755 --- a/tasks/WeeklyTask.php +++ b/tasks/WeeklyTask.php @@ -11,5 +11,4 @@ */ class WeeklyTask extends ScheduledTask { -} -?> \ No newline at end of file +} \ No newline at end of file