/** * Executes all ready cron tasks. * * If verbose mode is set, an info message will be printed if there is no task to * be run, or else for each starting task. * * @see execute * @param InputInterface $input The input stream used to get the argument and verbose option. * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. * @return int 0 */ protected function run_all(InputInterface $input, OutputInterface $output) { $run_tasks = $this->cron_manager->find_all_ready_tasks(); if ($run_tasks) { foreach ($run_tasks as $task) { if ($input->getOption('verbose')) { $output->writeln('<info>' . $this->user->lang('RUNNING_TASK', $task->get_name()) . '</info>'); } $task->run(); } } else { if ($input->getOption('verbose')) { $output->writeln('<info>' . $this->user->lang('CRON_NO_TASK') . '</info>'); } } return 0; }