diff options
Diffstat (limited to 'phpBB/install_new')
-rw-r--r-- | phpBB/install_new/app.php | 40 | ||||
-rw-r--r-- | phpBB/install_new/phpbbcli.php | 29 | ||||
-rw-r--r-- | phpBB/install_new/startup.php | 84 |
3 files changed, 97 insertions, 56 deletions
diff --git a/phpBB/install_new/app.php b/phpBB/install_new/app.php index b173f40dfc..b2de72dcbc 100644 --- a/phpBB/install_new/app.php +++ b/phpBB/install_new/app.php @@ -20,44 +20,21 @@ define('PHPBB_ENVIRONMENT', 'production'); $phpbb_root_path = '../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -// -// Let's do the common.php logic -// -require($phpbb_root_path . 'includes/startup.' . $phpEx); -require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); +$startup_new_path = $phpbb_root_path . 'install/update/update/new/install_new/startup.' . $phpEx; +$startup_path = (file_exists($startup_new_path)) ? $startup_new_path : $phpbb_root_path . 'install_new/startup.' . $phpEx; +require($startup_path); -$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); -$phpbb_class_loader->register(); - -// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. -$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; -$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; - -// Include files -require($phpbb_root_path . 'includes/functions.' . $phpEx); -require($phpbb_root_path . 'includes/functions_content.' . $phpEx); -include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); -require($phpbb_root_path . 'includes/functions_user.' . $phpEx); -require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); +/** @var \phpbb\filesystem\filesystem $phpbb_filesystem */ +$phpbb_filesystem = $phpbb_installer_container->get('filesystem'); -// Set PHP error handler to ours -set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +/** @var \phpbb\template\template $template */ +$template = $phpbb_installer_container->get('template'); -$phpbb_installer_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); -$phpbb_installer_container = $phpbb_installer_container_builder - ->with_environment('installer') - ->without_extensions() - ->get_container(); // Path to templates $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); $paths = array_filter($paths, 'is_dir'); -/** @var \phpbb\filesystem\filesystem $phpbb_filesystem */ -$phpbb_filesystem = $phpbb_installer_container->get('filesystem'); - -/** @var \phpbb\template\template $template */ -$template = $phpbb_installer_container->get('template'); $template->set_custom_style(array( array( 'name' => 'adm', @@ -65,6 +42,9 @@ $template->set_custom_style(array( ), ), $paths); +/* @var $phpbb_dispatcher \phpbb\event\dispatcher */ +$phpbb_dispatcher = $phpbb_installer_container->get('dispatcher'); + /** @var \phpbb\language\language $language */ $language = $phpbb_installer_container->get('language'); $language->add_lang(array('common', 'acp/common', 'acp/board', 'install_new', 'posting')); diff --git a/phpBB/install_new/phpbbcli.php b/phpBB/install_new/phpbbcli.php index c1e9a9eaef..49a2920900 100644 --- a/phpBB/install_new/phpbbcli.php +++ b/phpBB/install_new/phpbbcli.php @@ -27,32 +27,9 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1); // // Let's do the common.php logic // -require($phpbb_root_path . 'includes/startup.' . $phpEx); -require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); - -$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); -$phpbb_class_loader->register(); - -// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. -$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; -$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; - -// Include files -require($phpbb_root_path . 'includes/functions.' . $phpEx); -require($phpbb_root_path . 'includes/functions_content.' . $phpEx); -include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); -require($phpbb_root_path . 'includes/functions_user.' . $phpEx); -require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); - -// Set PHP error handler to ours -set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); - -$phpbb_installer_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); -$phpbb_installer_container = $phpbb_installer_container_builder - ->with_environment('installer') - ->without_extensions() - ->without_cache() - ->get_container(); +$startup_new_path = $phpbb_root_path . 'install/update/update/new/install_new/startup.' . $phpEx; +$startup_path = (file_exists($startup_new_path)) ? $startup_new_path : $phpbb_root_path . 'install_new/startup.' . $phpEx; +require($startup_path); /** @var \phpbb\filesystem\filesystem $phpbb_filesystem */ $phpbb_filesystem = $phpbb_installer_container->get('filesystem'); diff --git a/phpBB/install_new/startup.php b/phpBB/install_new/startup.php new file mode 100644 index 0000000000..766f6be38a --- /dev/null +++ b/phpBB/install_new/startup.php @@ -0,0 +1,84 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** @ignore */ +if (!defined('IN_PHPBB') || !defined('IN_INSTALL')) +{ + exit; +} + +function phpbb_require_updated($path, $phpbb_root_path, $optional = false) +{ + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + require($new_path); + } + else if (!$optional || file_exists($old_path)) + { + require($old_path); + } +} + +function phpbb_include_updated($path, $phpbb_root_path, $optional = false) +{ + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + include($new_path); + } + else if (!$optional || file_exists($old_path)) + { + include($old_path); + } +} + +phpbb_require_updated('includes/startup.' . $phpEx, $phpbb_root_path); +phpbb_require_updated('phpbb/class_loader.' . $phpEx, $phpbb_root_path); + +$phpbb_class_loader_new = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx); +$phpbb_class_loader_new->register(); +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); +$phpbb_class_loader->register(); +$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); +$phpbb_class_loader_ext->register(); + +// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. +$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; +$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; + +// Include files +phpbb_require_updated('includes/functions.' . $phpEx, $phpbb_root_path); +phpbb_require_updated('includes/functions_content.' . $phpEx, $phpbb_root_path); +phpbb_include_updated('includes/functions_compatibility.' . $phpEx, $phpbb_root_path); +phpbb_require_updated('includes/functions_user.' . $phpEx, $phpbb_root_path); +phpbb_require_updated('includes/utf/utf_tools.' . $phpEx, $phpbb_root_path); + +// Set PHP error handler to ours +set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); + +$phpbb_installer_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +$phpbb_installer_container_builder + ->with_environment('installer') + ->without_extensions(); + +$other_config_path = $phpbb_root_path . 'install/update/new/config'; +$config_path = (file_exists($other_config_path . '/installer/config.yml')) ? $other_config_path : $phpbb_root_path . 'config'; + +$phpbb_installer_container = $phpbb_installer_container_builder + ->with_config_path($config_path) + ->get_container(); |