src/Dev/TaskRunner.php
public function runTask($request)
    {
        $name = $request->param('TaskName');
        $tasks = $this->getTasks();

        $title = function ($content) {
            printf(Director::is_cli() ? "%s\n\n" : '<h1>%s</h1>', $content);
        };

        $message = function ($content) {
            printf(Director::is_cli() ? "%s\n" : '<p>%s</p>', $content);
        };

        foreach ($tasks as $task) {
            if ($task['segment'] == $name) {
                /** @var BuildTask $inst */
                $inst = Injector::inst()->create($task['class']);
                $title(sprintf('Running Task %s', $inst->getTitle()));

                if (!$inst->isEnabled()) {
                    $message('The task is disabled');
                    return;
                }

                $inst->run($request);
                return;
            }
        }

        $message(sprintf('The build task "%s" could not be found', Convert::raw2xml($name)));
    }
public function runTask($request)
    {
        $name = $request->param('TaskName');
        $tasks = $this->getTasks();

        $title = function ($content) {
            printf(Director::is_cli() ? "%s\n\n" : '<h1>%s</h1>', $content);
        };

        $message = function ($content) {
            printf(Director::is_cli() ? "%s\n" : '<p>%s</p>', $content);
        };

        foreach ($tasks as $task) {
            if ($task['segment'] == $name) {
                /** @var BuildTask $inst */
                $inst = Injector::inst()->create($task['class']);
                $title(sprintf('Running Task %s', $inst->getTitle()));

                if (!$inst->isEnabled()) {
                    $message('The task is disabled');
                    return;
                }

                $inst->run($request);
                return;
            }
        }

        $message(sprintf('The build task "%s" could not be found', Convert::raw2xml($name)));
    }
public function runTask ( $ request ) { $ name = $ request -> param ( 'TaskName' ) ; $ tasks = $ this -> getTasks ( ) ; $ title = function ( $ content ) { printf ( Director :: is_cli ( ) ? "%s\n\n" : '<h1>%s</h1>' , $ content ) ; } ; $ message = function ( $ content ) { printf ( Director :: is_cli ( ) ? "%s\n" : '<p>%s</p>' , $ content ) ; } ; foreach ( $ tasks as $ task ) { if ( $ task [ 'segment' ] == $ name ) { /** @var BuildTask $inst */ $ inst = Injector :: inst ( ) -> create ( $ task [ 'class' ] ) ; $ title ( sprintf ( 'Running Task %s' , $ inst -> getTitle ( ) ) ) ; if ( ! $ inst -> isEnabled ( ) ) { $ message ( 'The task is disabled' ) ; return ; } $ inst -> run ( $ request ) ; return ; } } $ message ( sprintf ( 'The build task "%s" could not be found' , Convert :: raw2xml ( $ name ) ) ) ; }
Runs a BuildTask
@param HTTPRequest $request
Runs a BuildTask