/** * Constructor * * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler * @param \phpbb\install\helper\container_factory $container Installer's DI container * @param \phpbb\language\language_file_helper $language_helper Language file helper service */ public function __construct(\phpbb\install\helper\iohandler\iohandler_interface $iohandler, \phpbb\install\helper\container_factory $container, \phpbb\language\language_file_helper $language_helper) { $this->db = $container->get('dbal.conn'); $this->iohandler = $iohandler; $this->language_helper = $language_helper; parent::__construct(true); }
/** * Constructor * * @param config $config Installer's config * @param container_factory $container phpBB's DI contianer */ public function __construct(config $config, container_factory $container) { $this->config = $config; $this->extension_manager = $container->get('ext.manager'); $this->migrator = $container->get('migrator'); parent::__construct(true); }
/** * Constructor * * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler * @param \phpbb\install\helper\container_factory $container Installer's DI container */ public function __construct(\phpbb\install\helper\iohandler\iohandler_interface $iohandler, \phpbb\install\helper\container_factory $container) { $this->db = $container->get('dbal.conn'); $this->extension_manager = $container->get('ext.manager'); $this->iohandler = $iohandler; $this->module_manager = $container->get('module.manager'); parent::__construct(true); }
/** * Constructor * * @parma config $config Installer's config * @param iohandler_interface $iohandler Installer's input-output handler * @param container_factory $container Installer's DI container */ public function __construct(config $config, iohandler_interface $iohandler, container_factory $container) { $this->config = $config; $this->db = $container->get('dbal.conn'); $this->extension_manager = $container->get('ext.manager'); $this->iohandler = $iohandler; $this->module_manager = $container->get('module.manager'); parent::__construct(true); }
/** * Constructor * * @param container_factory $container * @param config $config * @param iohandler_interface $iohandler * @param update_helper $update_helper * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(container_factory $container, config $config, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path, $php_ext) { $this->installer_config = $config; $this->iohandler = $iohandler; $this->update_helper = $update_helper; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->cache = $container->get('cache.driver'); parent::__construct(false); }
/** * Constructor * * @param container_factory $container * @param config $config * @param iohandler_interface $iohandler * @param filesystem $filesystem * @param factory $file_updater_factory */ public function __construct(container_factory $container, config $config, iohandler_interface $iohandler, filesystem $filesystem, factory $file_updater_factory) { $this->installer_config = $config; $this->iohandler = $iohandler; $this->filesystem = $filesystem; $this->cache = $container->get('cache.driver'); // Initialize compression file updater $this->file_updater = $file_updater_factory->get('compression'); parent::__construct(false); }
/** * Constructor * * @param \phpbb\install\helper\database $db_helper Installer's database helper * @param \phpbb\install\helper\config $config Installer config * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler * @param \phpbb\install\helper\container_factory $container Installer's DI container * @param \phpbb\language\language $language Language service * @param string $root_path Root path of phpBB */ public function __construct(\phpbb\install\helper\database $db_helper, \phpbb\install\helper\config $config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, \phpbb\install\helper\container_factory $container, \phpbb\language\language $language, $root_path) { $this->db = $container->get('dbal.conn.driver'); $this->database_helper = $db_helper; $this->config = $config; $this->iohandler = $iohandler; $this->language = $language; $this->phpbb_root_path = $root_path; parent::__construct(true); }
/** * Constructor * * @param container_factory $container * @param filesystem $filesystem * @param iohandler_interface $iohandler * @param update_helper $update_helper * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(container_factory $container, filesystem $filesystem, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path, $php_ext) { $this->filesystem = $filesystem; $this->iohandler = $iohandler; $this->update_helper = $update_helper; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->tests_passed = true; $this->config = $container->get('config'); $this->version_helper = $container->get('version_helper'); parent::__construct(true); }
/** * Constructor * * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem service * @param \phpbb\install\helper\config $install_config Installer's config helper * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler * @param \phpbb\install\helper\container_factory $container Installer's DI container * @param \phpbb\language\language $language Language service * @param string $phpbb_root_path Path to phpBB's root */ public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, \phpbb\install\helper\container_factory $container, \phpbb\language\language $language, $phpbb_root_path) { $this->db = $container->get('dbal.conn'); $this->filesystem = $filesystem; $this->install_config = $install_config; $this->iohandler = $iohandler; $this->language = $language; $this->password_manager = $container->get('passwords.manager'); $this->phpbb_root_path = $phpbb_root_path; // Table names $this->config_table = $container->get_parameter('tables.config'); $this->forums_table = $container->get_parameter('tables.forums'); $this->topics_table = $container->get_parameter('tables.topics'); $this->user_table = $container->get_parameter('tables.users'); $this->moderator_cache_table = $container->get_parameter('tables.moderator_cache'); $this->posts_table = $container->get_parameter('tables.posts'); parent::__construct(true); }
/** * Constructor * * @param \phpbb\install\helper\container_factory $container * @param \phpbb\install\helper\config $install_config * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, $phpbb_root_path, $php_ext) { $this->install_config = $install_config; $this->iohandler = $iohandler; $this->auth = $container->get('auth'); $this->language = $container->get('language'); $this->log = $container->get('log'); $this->user = $container->get('user'); $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; // We need to reload config for cases when it doesn't have all values $this->config = new db($container->get('dbal.conn'), $container->get('cache.driver'), $container->get_parameter('tables.config')); parent::__construct(true); }
/** * Constructor * * @param \phpbb\install\helper\container_factory $container * @param \phpbb\filesystem\filesystem $filesystem * @param \phpbb\install\helper\config $installer_config * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler * @param \phpbb\language\language $language * @param string $phpbb_root_path */ public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\filesystem\filesystem $filesystem, \phpbb\install\helper\config $installer_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, \phpbb\language\language $language, $phpbb_root_path) { $this->filesystem = $filesystem; $this->installer_config = $installer_config; $this->iohandler = $iohandler; $this->language = $language; $this->phpbb_root_path = $phpbb_root_path; $this->cache = $container->get('cache.driver'); $this->config = $container->get('config'); $this->extension_manager = $container->get('ext.manager'); $this->log = $container->get('log'); $this->migrator = $container->get('migrator'); $this->user = $container->get('user'); parent::__construct(true); }
/** * Constructor * * @param container_factory $container * @param config $install_config * @param iohandler_interface $iohandler * @param $update_helper $update_helper * @param string $phpbb_root_path phpBB root path */ public function __construct(container_factory $container, config $install_config, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path) { $this->install_config = $install_config; $this->iohandler = $iohandler; $this->extension_table = $container->get_parameter('tables.ext'); $this->log = $container->get('log'); $this->user = $container->get('user'); $this->extension_manager = $container->get('ext.manager'); $this->cache = $container->get('cache.driver'); $this->config = $container->get('config'); $this->db = $container->get('dbal.conn'); $this->update_helper = $update_helper; $this->finder = new Finder(); $this->finder->in($phpbb_root_path . 'ext/')->ignoreUnreadableDirs()->depth('< 3')->files()->name('composer.json'); // Make sure asset version exists in config. Otherwise we might try to // insert the assets_version setting into the database and cause a // duplicate entry error. if (!isset($this->config['assets_version'])) { $this->config['assets_version'] = 0; } parent::__construct(true); }
/** * Run phpBB installer */ public function run() { if ($this->iohandler instanceof ajax_iohandler) { $this->iohandler->acquire_lock(); } // Load install progress $this->install_config->load_config(); if (!$this->install_config->get('cache_purged_before', false) && $this->purge_cache_before) { /** @var \phpbb\cache\driver\driver_interface $cache */ $cache = $this->container_factory->get('cache.driver'); $cache->purge(); $this->install_config->set('cache_purged_before', true); } // Recover install progress $module_index = $this->recover_progress(); // Variable used to check if the install process have been finished $install_finished = false; $fail_cleanup = false; $send_refresh = false; // We are installing something, so the introduction stage can go now... $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); if ($this->install_config->get_task_progress_count() === 0) { // Count all tasks in the current installer modules $step_count = 0; /** @var \phpbb\install\module_interface $module */ foreach ($this->installer_modules as $name => $module) { $module_step_count = $module->get_step_count(); $step_count += $module_step_count; $this->module_step_count[$name] = $module_step_count; } // Set task count $this->install_config->set_task_progress_count($step_count); } // Set up progress information $this->iohandler->set_task_count($this->install_config->get_task_progress_count()); try { $iterator = $this->installer_modules->getIterator(); if ($module_index < $iterator->count()) { $iterator->seek($module_index); } else { $iterator->seek($module_index - 1); $iterator->next(); } while ($iterator->valid()) { $module = $iterator->current(); $name = $iterator->key(); // Check if module should be executed if (!$module->is_essential() && !$module->check_requirements()) { $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); $this->iohandler->add_log_message(array('SKIP_MODULE', $name)); $this->install_config->increment_current_task_progress($this->module_step_count[$name]); } else { // Set the correct stage in the navigation bar $this->install_config->set_active_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_active_stage_menu($module->get_navigation_stage_path()); $this->iohandler->send_response(); $module->run(); $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); } $module_index++; $iterator->next(); // Save progress $this->install_config->set_active_module($name, $module_index); if ($iterator->valid() && ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)) { throw new resource_limit_reached_exception(); } } // Installation finished $install_finished = true; if ($this->iohandler instanceof cli_iohandler) { $this->iohandler->add_success_message('INSTALLER_FINISHED'); } else { global $SID; $acp_url = $this->web_root . 'adm/index.php' . $SID; $this->iohandler->add_success_message('INSTALLER_FINISHED', array('ACP_LINK', $acp_url)); } } catch (user_interaction_required_exception $e) { $this->iohandler->send_response(true); } catch (resource_limit_reached_exception $e) { $send_refresh = true; } catch (jump_to_restart_point_exception $e) { $this->install_config->jump_to_restart_point($e->get_restart_point_name()); $send_refresh = true; } catch (\Exception $e) { $this->iohandler->add_error_message($e->getMessage()); $this->iohandler->send_response(true); $fail_cleanup = true; } if ($this->iohandler instanceof ajax_iohandler) { $this->iohandler->release_lock(); } if ($install_finished) { // Send install finished message $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); $this->iohandler->send_response(true); } else { if ($send_refresh) { $this->iohandler->request_refresh(); $this->iohandler->send_response(true); } } // Save install progress try { if ($install_finished || $fail_cleanup) { $this->install_config->clean_up_config_file(); $this->cache->purge(); try { /** @var \phpbb\cache\driver\driver_interface $cache */ $cache = $this->container_factory->get('cache.driver'); $cache->purge(); } catch (cannot_build_container_exception $e) { // Do not do anything, this just means there is no config.php yet } } else { $this->install_config->save_config(); } } catch (installer_config_not_writable_exception $e) { // It is allowed to fail this test during requirements testing $progress_data = $this->install_config->get_progress_data(); if ($progress_data['last_task_module_name'] !== 'installer.module.requirements_install') { $this->iohandler->add_error_message('INSTALLER_CONFIG_NOT_WRITABLE'); } } }
/** * Constructor * * @param \phpbb\install\helper\container_factory $container phpBB's DI contianer */ public function __construct(\phpbb\install\helper\container_factory $container) { $this->extension_manager = $container->get('ext.manager'); $this->migrator = $container->get('migrator'); parent::__construct(true); }
/** * Constructor * * @param driver_interface $cache * @param container_factory $container * @param database $db_helper * @param helper $controller_helper * @param install_helper $install_helper * @param factory $iohandler * @param language $language * @param navigation_provider $nav * @param request_interface $request * @param template $template * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(driver_interface $cache, container_factory $container, database $db_helper, helper $controller_helper, install_helper $install_helper, factory $iohandler, language $language, navigation_provider $nav, request_interface $request, template $template, $phpbb_root_path, $php_ext) { $this->installer_cache = $cache; $this->controller_helper = $controller_helper; $this->db_helper = $db_helper; $this->install_helper = $install_helper; $this->language = $language; $this->navigation_provider = $nav; $this->request = $request; $this->template = $template; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $iohandler->set_environment('ajax'); $this->iohandler = $iohandler->get(); if (!$this->install_helper->is_phpbb_installed() || !defined('IN_INSTALL')) { throw new http_exception(403, 'INSTALL_PHPBB_NOT_INSTALLED'); } $this->controller_helper->handle_language_select(); $this->cache = $container->get('cache.driver'); $this->config = $container->get('config'); $this->config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext); $this->db = $container->get('dbal.conn.driver'); $this->config_table = $container->get_parameter('tables.config'); $this->session_keys_table = $container->get_parameter('tables.sessions_keys'); $this->session_table = $container->get_parameter('tables.sessions'); }
/** * Constructor * * @param \phpbb\install\helper\config $install_config Installer's config * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Input-output handler for the installer * @param \phpbb\install\helper\container_factory $container Installer's DI container * @param \phpbb\language\language $language Language provider * @param string $phpbb_root_path Relative path to phpBB root * @param string $php_ext PHP extension */ public function __construct(\phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, \phpbb\install\helper\container_factory $container, \phpbb\language\language $language, $phpbb_root_path, $php_ext) { parent::__construct(true); $this->db = $container->get('dbal.conn'); $this->install_config = $install_config; $this->io_handler = $iohandler; $this->language = $language; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; }