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

migrate.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 2.80 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\db;
 014   
 015  use Symfony\Component\Console\Input\InputInterface;
 016  use Symfony\Component\Console\Output\OutputInterface;
 017   
 018  class migrate extends \phpbb\console\command\command
 019  {
 020      /** @var \phpbb\db\migrator */
 021      protected $migrator;
 022   
 023      /** @var \phpbb\extension\manager */
 024      protected $extension_manager;
 025   
 026      /** @var \phpbb\config\config */
 027      protected $config;
 028   
 029      /** @var \phpbb\cache\service */
 030      protected $cache;
 031   
 032      /** @var \phpbb\log\log */
 033      protected $log;
 034   
 035      /** @var string phpBB root path */
 036      protected $phpbb_root_path;
 037   
 038      function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, $phpbb_root_path)
 039      {
 040          $this->migrator = $migrator;
 041          $this->extension_manager = $extension_manager;
 042          $this->config = $config;
 043          $this->cache = $cache;
 044          $this->log = $log;
 045          $this->phpbb_root_path = $phpbb_root_path;
 046          parent::__construct($user);
 047          $this->user->add_lang(array('common', 'install', 'migrator'));
 048      }
 049   
 050      protected function configure()
 051      {
 052          $this
 053              ->setName('db:migrate')
 054              ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE'))
 055          ;
 056      }
 057   
 058      protected function execute(InputInterface $input, OutputInterface $output)
 059      {
 060          $this->migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($this->user, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log'));
 061   
 062          $this->migrator->create_migrations_table();
 063   
 064          $this->cache->purge();
 065   
 066          $this->load_migrations();
 067          $orig_version = $this->config['version'];
 068          while (!$this->migrator->finished())
 069          {
 070              try
 071              {
 072                  $this->migrator->update();
 073              }
 074              catch (\phpbb\db\migration\exception $e)
 075              {
 076                  $output->writeln('<error>' . $e->getLocalisedMessage($this->user) . '</error>');
 077                  $this->finalise_update();
 078                  return 1;
 079              }
 080          }
 081   
 082          if ($orig_version != $this->config['version'])
 083          {
 084              $this->log->add('admin', ANONYMOUS, '', 'LOG_UPDATE_DATABASE', time(), array($orig_version, $this->config['version']));
 085          }
 086   
 087          $this->finalise_update();
 088          $output->writeln($this->user->lang['DATABASE_UPDATE_COMPLETE']);
 089      }
 090   
 091      protected function load_migrations()
 092      {
 093          $migrations = $this->extension_manager
 094              ->get_finder()
 095              ->core_path('phpbb/db/migration/data/')
 096              ->extension_directory('/migrations')
 097              ->get_classes();
 098   
 099          $this->migrator->set_migrations($migrations);
 100      }
 101   
 102      protected function finalise_update()
 103      {
 104          $this->cache->purge();
 105          $this->config->increment('assets_version', 1);
 106      }
 107  }
 108