/** * Run all commands that are due to be run */ public function runDue(Debugger $debugger) { $debugger->log('Running commands...'); /** @var \Indatus\Dispatcher\BackgroundProcessRunner $backgroundProcessRunner */ $backgroundProcessRunner = App::make('Indatus\\Dispatcher\\BackgroundProcessRunner'); /** @var \Indatus\Dispatcher\Queue $queue */ $queue = $this->scheduleService->getQueue($debugger); foreach ($queue->flush() as $queueItem) { /** @var \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $command */ $command = $queueItem->getCommand(); //determine if the command is enabled if ($command->isEnabled()) { if ($this->runnableInCurrentMaintenanceSetting($command)) { if ($this->runnableInEnvironment($command)) { $scheduler = $queueItem->getScheduler(); $backgroundProcessRunner->run($command, $scheduler->getArguments(), $scheduler->getOptions(), $debugger); } else { $debugger->commandNotRun($command, 'Command is not configured to run in ' . App::environment()); } } else { $debugger->commandNotRun($command, 'Command is not configured to run while application is in maintenance mode'); } } else { $debugger->commandNotRun($command, 'Command is disabled'); } } }
/** * Execute the console command. * * @return mixed */ public function fire() { $this->scheduleService->printSummary(); }