[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 namespace phpbb\console\command\cron; 14 15 use Symfony\Component\Console\Input\InputInterface; 16 use Symfony\Component\Console\Output\OutputInterface; 17 use Symfony\Component\Console\Style\SymfonyStyle; 18 19 class cron_list extends \phpbb\console\command\command 20 { 21 /** @var \phpbb\cron\manager */ 22 protected $cron_manager; 23 24 /** 25 * Constructor 26 * 27 * @param \phpbb\user $user User instance 28 * @param \phpbb\cron\manager $cron_manager Cron manager 29 */ 30 public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager) 31 { 32 $this->cron_manager = $cron_manager; 33 parent::__construct($user); 34 } 35 36 /** 37 * {@inheritdoc} 38 */ 39 protected function configure() 40 { 41 $this 42 ->setName('cron:list') 43 ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_LIST')) 44 ; 45 } 46 47 /** 48 * Executes the command cron:list. 49 * 50 * Prints a list of ready and unready cron jobs. 51 * 52 * @param InputInterface $input An InputInterface instance 53 * @param OutputInterface $output An OutputInterface instance 54 * 55 * @return void 56 */ 57 protected function execute(InputInterface $input, OutputInterface $output) 58 { 59 $io = new SymfonyStyle($input, $output); 60 61 $tasks = $this->cron_manager->get_tasks(); 62 63 if (empty($tasks)) 64 { 65 $io->error($this->user->lang('CRON_NO_TASKS')); 66 return; 67 } 68 69 $ready_tasks = $not_ready_tasks = array(); 70 foreach ($tasks as $task) 71 { 72 if ($task->is_ready()) 73 { 74 $ready_tasks[] = $task->get_name(); 75 } 76 else 77 { 78 $not_ready_tasks[] = $task->get_name(); 79 } 80 } 81 82 if (!empty($ready_tasks)) 83 { 84 $io->title($this->user->lang('TASKS_READY')); 85 $io->listing($ready_tasks); 86 } 87 88 if (!empty($not_ready_tasks)) 89 { 90 $io->title($this->user->lang('TASKS_NOT_READY')); 91 $io->listing($not_ready_tasks); 92 } 93 } 94 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |