aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/database_update.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/install/database_update.php')
-rw-r--r--phpBB/install/database_update.php45
1 files changed, 30 insertions, 15 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 80fd40a944..299467b5f3 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -74,37 +74,46 @@ require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
-include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $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');
// Set up container (must be done here because extensions table may not exist)
-$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
-$phpbb_container_builder->set_use_extensions(false);
-$phpbb_container_builder->set_use_kernel_pass(false);
-$phpbb_container_builder->set_dump_container(false);
-$phpbb_container = $phpbb_container_builder->get_container();
+$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx);
+$phpbb_container = $phpbb_container_builder
+ ->with_config($phpbb_config_php_file)
+ ->without_extensions()
+ ->without_cache()
+ ->get_container()
+;
// set up caching
+/* @var $cache \phpbb\cache\service */
$cache = $phpbb_container->get('cache');
// Instantiate some basic classes
+/* @var $phpbb_dispatcher \phpbb\event\dispatcher */
$phpbb_dispatcher = $phpbb_container->get('dispatcher');
+
+/* @var $request \phpbb\request\request_interface */
$request = $phpbb_container->get('request');
+
+/* @var $user \phpbb\user */
$user = $phpbb_container->get('user');
+
+/* @var $auth \phpbb\auth\auth */
$auth = $phpbb_container->get('auth');
+
+/* @var $db \phpbb\db\driver\driver_interface */
$db = $phpbb_container->get('dbal.conn');
-$phpbb_log = $phpbb_container->get('log');
-// make sure request_var uses this request instance
-request_var('', 0, false, false, $request); // "dependency injection" for a function
+/* @var $phpbb_log \phpbb\log\log_interface */
+$phpbb_log = $phpbb_container->get('log');
// Grab global variables, re-cache if necessary
+/* @var $config \phpbb\config\config */
$config = $phpbb_container->get('config');
-set_config(null, null, null, $config);
-set_config_count(null, null, null, $config);
if (!isset($config['version_update_from']))
{
@@ -121,6 +130,7 @@ if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
+ /* @var $phpbb_hook_finder \phpbb\hook\finder */
$phpbb_hook_finder = $phpbb_container->get('hook_finder');
foreach ($phpbb_hook_finder->find() as $hook)
{
@@ -173,11 +183,16 @@ define('IN_DB_UPDATE', true);
// End startup code
+/* @var $migrator \phpbb\db\migrator */
$migrator = $phpbb_container->get('migrator');
-$migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($user, new \phpbb\db\html_migrator_output_handler($user), $phpbb_root_path . 'store/migrations_' . time() . '.log'));
+
+/** @var \phpbb\filesystem\filesystem_interface $phpbb_filesystem */
+$phpbb_filesystem = $phpbb_container->get('filesystem');
+$migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($user, new \phpbb\db\html_migrator_output_handler($user), $phpbb_root_path . 'store/migrations_' . time() . '.log', $phpbb_filesystem));
$migrator->create_migrations_table();
+/* @var $phpbb_extension_manager \phpbb\extension\manager */
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
$migrations = $phpbb_extension_manager
@@ -190,8 +205,8 @@ $migrator->set_migrations($migrations);
// What is a safe limit of execution time? Half the max execution time should be safe.
// No more than 15 seconds so the user isn't sitting and waiting for a very long time
-$phpbb_ini = new \phpbb\php\ini();
-$safe_time_limit = min(15, ($phpbb_ini->get_int('max_execution_time') / 2));
+$phpbb_ini = new \bantu\IniGetWrapper\IniGetWrapper();
+$safe_time_limit = min(15, ($phpbb_ini->getNumeric('max_execution_time') / 2));
// While we're going to try limit this to half the max execution time,
// we want to try and take additional measures to prevent hitting the
@@ -231,7 +246,7 @@ while (!$migrator->finished())
if ($orig_version != $config['version'])
{
- add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $config['version']);
+ $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UPDATE_DATABASE', false, array($orig_version, $config['version']));
}
echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '<br />';