Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

cron_list.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 2.37 KiB


001  <?php
002  /**
003  *
004  * This file is part of the phpBB Forum Software package.
005  *
006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
007  * @license GNU General Public License, version 2 (GPL-2.0)
008  *
009  * For full copyright and license information, please see
010  * the docs/CREDITS.txt file.
011  *
012  */
013  namespace phpbb\console\command\cron;
014   
015  use Symfony\Component\Console\Input\InputInterface;
016  use Symfony\Component\Console\Output\OutputInterface;
017   
018  class cron_list extends \phpbb\console\command\command
019  {
020      /** @var \phpbb\cron\manager */
021      protected $cron_manager;
022   
023      /**
024      * Constructor
025      *
026      * @param \phpbb\user            $user            User instance
027      * @param \phpbb\cron\manager    $cron_manager    Cron manager
028      */
029      public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager)
030      {
031          $this->cron_manager = $cron_manager;
032          parent::__construct($user);
033      }
034   
035      /**
036      * {@inheritdoc}
037      */
038      protected function configure()
039      {
040          $this
041              ->setName('cron:list')
042              ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_LIST'))
043          ;
044      }
045   
046      /**
047      * Executes the command cron:list.
048      *
049      * Prints a list of ready and unready cron jobs.
050      *
051      * @param InputInterface  $input  An InputInterface instance
052      * @param OutputInterface $output An OutputInterface instance
053      *
054      * @return null
055      */
056      protected function execute(InputInterface $input, OutputInterface $output)
057      {
058          $tasks = $this->cron_manager->get_tasks();
059   
060          if (empty($tasks))
061          {
062              $output->writeln($this->user->lang('CRON_NO_TASKS'));
063              return;
064          }
065   
066          $ready_tasks = array();
067          $not_ready_tasks = array();
068          foreach ($tasks as $task)
069          {
070              if ($task->is_ready())
071              {
072                  $ready_tasks[] = $task;
073              }
074              else
075              {
076                  $not_ready_tasks[] = $task;
077              }
078          }
079   
080          if (!empty($ready_tasks))
081          {
082              $output->writeln('<info>' . $this->user->lang('TASKS_READY') . '</info>');
083              $this->print_tasks_names($ready_tasks, $output);
084          }
085   
086          if (!empty($ready_tasks) && !empty($not_ready_tasks))
087          {
088              $output->writeln('');
089          }
090   
091          if (!empty($not_ready_tasks))
092          {
093              $output->writeln('<info>' . $this->user->lang('TASKS_NOT_READY') . '</info>');
094              $this->print_tasks_names($not_ready_tasks, $output);
095          }
096      }
097   
098      /**
099      * Print a list of cron jobs
100      *
101      * @param array                $tasks A list of task to display
102      * @param OutputInterface    $output An OutputInterface instance
103      */
104      protected function print_tasks_names(array $tasks, OutputInterface $output)
105      {
106          foreach ($tasks as $task)
107          {
108              $output->writeln($task->get_name());
109          }
110      }
111  }
112