From 8f5a0ad6f73e7b7757b02c827436384c96069b5a Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 09:20:50 +0200 Subject: [ticket/14039] Revamp updater PHPBB3-14039 --- phpBB/install_new/startup.php | 84 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 phpBB/install_new/startup.php (limited to 'phpBB/install_new/startup.php') 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 @@ + + * @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(); -- cgit v1.2.1 From d4dd112edf07eb45d4e73d78c47b48a94700e6c3 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sun, 18 Oct 2015 18:56:11 +0200 Subject: [ticket/14039] Include phpBB constants on startup PHPBB3-14039 --- phpBB/install_new/startup.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/install_new/startup.php') diff --git a/phpBB/install_new/startup.php b/phpBB/install_new/startup.php index 766f6be38a..4d558d015f 100644 --- a/phpBB/install_new/startup.php +++ b/phpBB/install_new/startup.php @@ -62,6 +62,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files +phpbb_require_updated('includes/constants.' . $phpEx, $phpbb_root_path); 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); -- cgit v1.2.1 From 56093d1c82d6f4d5c0f2741769eb071eb7bec5d7 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sun, 18 Oct 2015 19:18:53 +0200 Subject: [ticket/14039] Fix constants for the updater PHPBB3-14039 --- phpBB/install_new/startup.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/install_new/startup.php') diff --git a/phpBB/install_new/startup.php b/phpBB/install_new/startup.php index 4d558d015f..766f6be38a 100644 --- a/phpBB/install_new/startup.php +++ b/phpBB/install_new/startup.php @@ -62,7 +62,6 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files -phpbb_require_updated('includes/constants.' . $phpEx, $phpbb_root_path); 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); -- cgit v1.2.1