protected function executeTasks( array $tasks )
    {
        foreach ( $tasks as $scheduled => $taskList )
        {
            foreach ( $taskList as $cronjob )
            {
                if ( ( $task = $this->taskFactory->factory( $cronjob->task, $scheduled, $this->logger ) ) !== false )
                {
                    $this->logger->setTask( $task->getId() );
                    $this->logger->log( 'Start task execution.' );
                    $status = $task->execute();

                    switch ( $status )
                    {
                        case Executor::SUCCESS:
                            $this->logger->log( 'Finished task execution.' );
                            break;
                        case Executor::ERROR:
                            $this->logger->log( 'Error occured during task execution.', Logger::WARNING );
                            break;
                        case Executor::RESCHEDULE:
                            $this->logger->log( 'Task will be rescheduled for ' . $task->reScheduleTime . ' seconds.' );
                            $this->rescheduled[$scheduled + $task->reScheduleTime] = $cronjob;
                            break;
                        default:
                            $this->logger->log( 'Invalid status returned by task.', Logger::ERROR );
                            break;
                    }

                    $this->logger->setTask();
                }
            }
        }
    }
protected function executeTasks( array $tasks )
    {
        foreach ( $tasks as $scheduled => $taskList )
        {
            foreach ( $taskList as $cronjob )
            {
                if ( ( $task = $this->taskFactory->factory( $cronjob->task, $scheduled, $this->logger ) ) !== false )
                {
                    $this->logger->setTask( $task->getId() );
                    $this->logger->log( 'Start task execution.' );
                    $status = $task->execute();

                    switch ( $status )
                    {
                        case Executor::SUCCESS:
                            $this->logger->log( 'Finished task execution.' );
                            break;
                        case Executor::ERROR:
                            $this->logger->log( 'Error occured during task execution.', Logger::WARNING );
                            break;
                        case Executor::RESCHEDULE:
                            $this->logger->log( 'Task will be rescheduled for ' . $task->reScheduleTime . ' seconds.' );
                            $this->rescheduled[$scheduled + $task->reScheduleTime] = $cronjob;
                            break;
                        default:
                            $this->logger->log( 'Invalid status returned by task.', Logger::ERROR );
                            break;
                    }

                    $this->logger->setTask();
                }
            }
        }
    }
protected function executeTasks ( array $ tasks ) { foreach ( $ tasks as $ scheduled => $ taskList ) { foreach ( $ taskList as $ cronjob ) { if ( ( $ task = $ this -> taskFactory -> factory ( $ cronjob -> task , $ scheduled , $ this -> logger ) ) !== false ) { $ this -> logger -> setTask ( $ task -> getId ( ) ) ; $ this -> logger -> log ( 'Start task execution.' ) ; $ status = $ task -> execute ( ) ; switch ( $ status ) { case Executor :: SUCCESS : $ this -> logger -> log ( 'Finished task execution.' ) ; break ; case Executor :: ERROR : $ this -> logger -> log ( 'Error occured during task execution.' , Logger :: WARNING ) ; break ; case Executor :: RESCHEDULE : $ this -> logger -> log ( 'Task will be rescheduled for ' . $ task -> reScheduleTime . ' seconds.' ) ; $ this -> rescheduled [ $ scheduled + $ task -> reScheduleTime ] = $ cronjob ; break ; default : $ this -> logger -> log ( 'Invalid status returned by task.' , Logger :: ERROR ) ; break ; } $ this -> logger -> setTask ( ) ; } } } }
Execute scheduled tasks

Execute the given tasks.

If a task has a group assigned, it may not be executed in parallel with
tasks from the same group.

This basic task executor does not execute any tasks in parallel,
because it should not depend on any non-default extensions like
ext/pcntl.

@param array $tasks
@return void
Execute scheduled tasks