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

update.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 4.21 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\install\console\command\update;
 015   
 016  use phpbb\install\exception\installer_exception;
 017  use phpbb\install\helper\install_helper;
 018  use phpbb\install\helper\iohandler\cli_iohandler;
 019  use phpbb\install\helper\iohandler\factory;
 020  use phpbb\install\installer;
 021  use phpbb\install\updater_configuration;
 022  use phpbb\language\language;
 023  use Symfony\Component\Config\Definition\Exception\Exception;
 024  use Symfony\Component\Config\Definition\Processor;
 025  use Symfony\Component\Console\Input\InputArgument;
 026  use Symfony\Component\Console\Input\InputInterface;
 027  use Symfony\Component\Console\Output\OutputInterface;
 028  use Symfony\Component\Console\Style\SymfonyStyle;
 029  use Symfony\Component\Yaml\Exception\ParseException;
 030  use Symfony\Component\Yaml\Yaml;
 031   
 032  class update extends \phpbb\console\command\command
 033  {
 034      /**
 035       * @var factory
 036       */
 037      protected $iohandler_factory;
 038   
 039      /**
 040       * @var installer
 041       */
 042      protected $installer;
 043   
 044      /**
 045       * @var install_helper
 046       */
 047      protected $install_helper;
 048   
 049      /**
 050       * @var language
 051       */
 052      protected $language;
 053   
 054      /**
 055       * Constructor
 056       *
 057       * @param language            $language
 058       * @param factory            $factory
 059       * @param installer            $installer
 060       * @param install_helper    $install_helper
 061       */
 062      public function __construct(language $language, factory $factory, installer $installer, install_helper $install_helper)
 063      {
 064          $this->iohandler_factory = $factory;
 065          $this->installer = $installer;
 066          $this->language = $language;
 067          $this->install_helper = $install_helper;
 068   
 069          parent::__construct(new \phpbb\user($language, 'datetime'));
 070      }
 071   
 072      /**
 073       * {@inheritdoc}
 074       */
 075      protected function configure()
 076      {
 077          $this
 078              ->setName('update')
 079              ->addArgument(
 080                  'config-file',
 081                  InputArgument::REQUIRED,
 082                  $this->language->lang('CLI_CONFIG_FILE'))
 083              ->setDescription($this->language->lang('CLI_UPDATE_BOARD'))
 084          ;
 085      }
 086   
 087      /**
 088       * Executes the command update.
 089       *
 090       * Update the board
 091       *
 092       * @param InputInterface  $input  An InputInterface instance
 093       * @param OutputInterface $output An OutputInterface instance
 094       *
 095       * @return int
 096       */
 097      protected function execute(InputInterface $input, OutputInterface $output)
 098      {
 099          $this->iohandler_factory->set_environment('cli');
 100   
 101          /** @var cli_iohandler $iohandler */
 102          $iohandler = $this->iohandler_factory->get();
 103          $style = new SymfonyStyle($input, $output);
 104          $iohandler->set_style($style, $output);
 105   
 106          $this->installer->set_iohandler($iohandler);
 107   
 108          $config_file = $input->getArgument('config-file');
 109   
 110          if (!$this->install_helper->is_phpbb_installed())
 111          {
 112              $iohandler->add_error_message('INSTALL_PHPBB_NOT_INSTALLED');
 113   
 114              return 1;
 115          }
 116   
 117          if (!is_file($config_file))
 118          {
 119              $iohandler->add_error_message(array('MISSING_FILE', $config_file));
 120   
 121              return 1;
 122          }
 123   
 124          try
 125          {
 126              $config = Yaml::parse(file_get_contents($config_file), true, false);
 127          }
 128          catch (ParseException $e)
 129          {
 130              $iohandler->add_error_message(array('INVALID_YAML_FILE', $config_file));
 131   
 132              return 1;
 133          }
 134   
 135          $processor = new Processor();
 136          $configuration = new updater_configuration();
 137   
 138          try
 139          {
 140              $config = $processor->processConfiguration($configuration, $config);
 141          }
 142          catch (Exception $e)
 143          {
 144              $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage());
 145   
 146              return 1;
 147          }
 148   
 149          $this->register_configuration($iohandler, $config);
 150   
 151          try
 152          {
 153              $this->installer->run();
 154              return 0;
 155          }
 156          catch (installer_exception $e)
 157          {
 158              $iohandler->add_error_message($e->getMessage());
 159              return 1;
 160          }
 161      }
 162   
 163      /**
 164       * Register the configuration to simulate the forms.
 165       *
 166       * @param cli_iohandler $iohandler
 167       * @param array $config
 168       */
 169      private function register_configuration(cli_iohandler $iohandler, $config)
 170      {
 171          $iohandler->set_input('update_type', $config['type']);
 172          $iohandler->set_input('submit_update', 'submit');
 173   
 174          $iohandler->set_input('compression_method', '.tar');
 175          $iohandler->set_input('method', 'direct_file');
 176          $iohandler->set_input('submit_update_file', 'submit');
 177   
 178          $iohandler->set_input('submit_continue_file_update', 'submit');
 179   
 180          $iohandler->set_input('update-extensions', $config['extensions']);
 181      }
 182  }
 183