aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/startup.php
diff options
context:
space:
mode:
authorMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
committerMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
commit8ea437e30605e0f66b5220bf904a61d7c1d11ddd (patch)
treee0db2bb4a012d5b06a633160b19f62f4868ecd28 /phpBB/install/startup.php
parent36bc1870f21fac04736a1049c1d5b8e127d729f4 (diff)
parent2fdd46b36431ae0f58bb2e78e42553168db9a0ff (diff)
downloadforums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.gz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.bz2
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.xz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.zip
Merge remote-tracking branch 'upstream/prep-release-3.2.9'
Diffstat (limited to 'phpBB/install/startup.php')
-rw-r--r--phpBB/install/startup.php143
1 files changed, 143 insertions, 0 deletions
diff --git a/phpBB/install/startup.php b/phpBB/install/startup.php
new file mode 100644
index 0000000000..9a4f9bfe39
--- /dev/null
+++ b/phpBB/install/startup.php
@@ -0,0 +1,143 @@
+<?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);
+ }
+}
+
+function installer_msg_handler($errno, $msg_text, $errfile, $errline)
+{
+ global $phpbb_installer_container;
+
+ if (error_reporting() == 0)
+ {
+ return true;
+ }
+
+ switch ($errno)
+ {
+ case E_NOTICE:
+ case E_WARNING:
+ case E_USER_WARNING:
+ case E_USER_NOTICE:
+ $msg = '[phpBB Debug] "' . $msg_text . '" in file ' . $errfile . ' on line ' . $errline;
+
+ if (!empty($phpbb_installer_container))
+ {
+ try
+ {
+ /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */
+ $iohandler = $phpbb_installer_container->get('installer.helper.iohandler');
+ $iohandler->add_warning_message($msg);
+ }
+ catch (\phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception $e)
+ {
+ print($msg);
+ }
+ }
+ else
+ {
+ print($msg);
+ }
+
+ return;
+ break;
+ case E_USER_ERROR:
+ $msg = '<b>General Error:</b><br />' . $msg_text . '<br /> in file ' . $errfile . ' on line ' . $errline;
+
+ $backtrace = get_backtrace();
+ if ($backtrace)
+ {
+ $msg .= '<br /><br />BACKTRACE<br />' . $backtrace;
+ }
+
+ throw new \phpbb\exception\runtime_exception($msg);
+ break;
+ case E_DEPRECATED:
+ return true;
+ break;
+ }
+
+ return false;
+}
+
+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 = new \phpbb\class_loader('phpbb\\convert\\', "{$phpbb_root_path}install/convert/", $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 : 'installer_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)
+ ->with_custom_parameters(array('cache.driver.class' => 'phpbb\cache\driver\file'))
+ ->get_container();