Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

application.php

Zuletzt modifiziert: 01.05.2026, 11:25 - Dateigröße: 4.04 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   
 014  namespace phpbb\console;
 015   
 016  use Symfony\Component\Console\Input\InputDefinition;
 017  use Symfony\Component\Console\Shell;
 018  use Symfony\Component\Console\Input\InputInterface;
 019  use Symfony\Component\Console\Input\InputOption;
 020  use Symfony\Component\Console\Output\OutputInterface;
 021   
 022  class application extends \Symfony\Component\Console\Application
 023  {
 024      /**
 025      * @var bool Indicates whether or not we are in a shell
 026      */
 027      protected $in_shell = false;
 028   
 029      /**
 030      * @var \phpbb\config\config Config object
 031      */
 032      protected $config;
 033   
 034      /**
 035      * @var \phpbb\language\language Language object
 036      */
 037      protected $language;
 038   
 039      /**
 040      * @param string                        $name        The name of the application
 041      * @param string                        $version    The version of the application
 042      * @param \phpbb\language\language    $language    The user which runs the application (used for translation)
 043      * @param \phpbb\config\config        $config        Config object
 044      */
 045      public function __construct($name, $version, \phpbb\language\language $language, \phpbb\config\config $config)
 046      {
 047          $this->language = $language;
 048          $this->config = $config;
 049   
 050          parent::__construct($name, $version);
 051      }
 052   
 053      /**
 054      * {@inheritdoc}
 055      */
 056      protected function getDefaultInputDefinition()
 057      {
 058          $input_definition = parent::getDefaultInputDefinition();
 059   
 060          $this->register_global_options($input_definition);
 061   
 062          return $input_definition;
 063      }
 064   
 065      /**
 066      * Gets the help message.
 067      *
 068      * It's a hack of the default help message to display the --shell
 069      * option only for the application and not for all the commands.
 070      *
 071      * @return string A help message.
 072      */
 073      public function getHelp()
 074      {
 075          // If we are already in a shell
 076          // we do not want to have the --shell option available
 077          if ($this->in_shell)
 078          {
 079              return parent::getHelp();
 080          }
 081   
 082          try
 083          {
 084              $definition = $this->getDefinition();
 085              $definition->addOption(new InputOption(
 086                  '--shell',
 087                  '-s',
 088                  InputOption::VALUE_NONE,
 089                  $this->language->lang('CLI_DESCRIPTION_OPTION_SHELL')
 090              ));
 091          }
 092          catch (\LogicException $e)
 093          {
 094              // Do nothing
 095          }
 096   
 097          return parent::getHelp();
 098      }
 099   
 100      /**
 101      * Register a set of commands from the container
 102      *
 103      * @param \phpbb\di\service_collection    $command_collection    The console service collection
 104      */
 105      public function register_container_commands(\phpbb\di\service_collection $command_collection)
 106      {
 107          $commands_list = array_keys($command_collection->getArrayCopy());
 108          foreach ($commands_list as $service_command)
 109          {
 110              // config_text DB table does not exist in phpBB prior to 3.1
 111              // Hence skip cron tasks as they include reparser cron as it uses config_text table
 112              if (phpbb_version_compare($this->config['version'], '3.1.0', '<') && strpos($service_command, 'cron') !== false)
 113              {
 114                  continue;
 115              }
 116              $this->add($command_collection[$service_command]);
 117   
 118          }
 119      }
 120   
 121      /**
 122      * {@inheritdoc}
 123      */
 124      public function doRun(InputInterface $input, OutputInterface $output)
 125      {
 126          // Run a shell if the --shell (or -s) option is set and if no command name is specified
 127          // Also, we do not want to have the --shell option available if we are already in a shell
 128          if (!$this->in_shell && $this->getCommandName($input) === null && $input->hasParameterOption(array('--shell', '-s')))
 129          {
 130              $shell = new Shell($this);
 131              $this->in_shell = true;
 132              $shell->run();
 133   
 134              return 0;
 135          }
 136   
 137          return parent::doRun($input, $output);
 138      }
 139   
 140      /**
 141       * Register global options
 142       *
 143       * @param InputDefinition $definition An InputDefinition instance
 144       */
 145      protected function register_global_options(InputDefinition $definition)
 146      {
 147          try
 148          {
 149              $definition->addOption(new InputOption(
 150                  'safe-mode',
 151                  null,
 152                  InputOption::VALUE_NONE,
 153                  $this->language->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE')
 154              ));
 155   
 156              $definition->addOption(new InputOption(
 157                  'env',
 158                  'e',
 159                  InputOption::VALUE_REQUIRED,
 160                  $this->language->lang('CLI_DESCRIPTION_OPTION_ENV')
 161              ));
 162          }
 163          catch (\LogicException $e)
 164          {
 165              // Do nothing
 166          }
 167      }
 168  }
 169