[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/phpbb/install/module/install_finish/task/ -> populate_migrations.php (source)

   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  
  14  namespace phpbb\install\module\install_finish\task;
  15  
  16  use phpbb\install\exception\resource_limit_reached_exception;
  17  use phpbb\install\helper\config;
  18  use phpbb\install\helper\container_factory;
  19  
  20  /**
  21   * Populates migrations
  22   */
  23  class populate_migrations extends \phpbb\install\task_base
  24  {
  25      /**
  26       * @var config
  27       */
  28      protected $config;
  29  
  30      /**
  31       * @var \phpbb\extension\manager
  32       */
  33      protected $extension_manager;
  34  
  35      /**
  36       * @var \phpbb\db\migrator
  37       */
  38      protected $migrator;
  39  
  40      /**
  41       * Constructor
  42       *
  43       * @param config            $config        Installer's config
  44       * @param container_factory    $container    phpBB's DI contianer
  45       */
  46  	public function __construct(config $config, container_factory $container)
  47      {
  48          $this->config                = $config;
  49          $this->extension_manager    = $container->get('ext.manager');
  50          $this->migrator                = $container->get('migrator');
  51  
  52          parent::__construct(true);
  53      }
  54  
  55      /**
  56       * {@inheritdoc}
  57       */
  58  	public function run()
  59      {
  60          if (!$this->config->get('populate_migration_refresh_before', false))
  61          {
  62              if ($this->config->get_time_remaining() < 1)
  63              {
  64                  $this->config->set('populate_migration_refresh_before', true);
  65                  throw new resource_limit_reached_exception();
  66              }
  67          }
  68  
  69          $finder = $this->extension_manager->get_finder();
  70  
  71          $migrations = $finder
  72              ->core_path('phpbb/db/migration/data/')
  73              ->set_extensions(array())
  74              ->get_classes();
  75          $this->migrator->populate_migrations($migrations);
  76      }
  77  
  78      /**
  79       * {@inheritdoc}
  80       */
  81  	static public function get_step_count()
  82      {
  83          return 1;
  84      }
  85  
  86      /**
  87       * {@inheritdoc}
  88       */
  89  	public function get_task_lang_name()
  90      {
  91          return 'TASK_POPULATE_MIGRATIONS';
  92      }
  93  }


Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1