From 6dd462060999f81baa67c20f536f86e6bb6198ce Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Wed, 23 Oct 2013 21:13:25 +0200
Subject: [PATCH] [ticket/11031] Fix container construction and missing objects

PHPBB3-11031
---
 phpBB/install/install_convert.php | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 4d3e1d3d4a..1c7e2dca76 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -90,13 +90,21 @@ class install_convert extends module
 	function main($mode, $sub)
 	{
 		global $lang, $template, $phpbb_root_path, $phpEx, $cache, $config, $language, $table_prefix;
-		global $convert;
+		global $convert, $request, $phpbb_container;
 
 		$this->tpl_name = 'install_convert';
 		$this->mode = $mode;
 
 		$convert = new convert($this->p_master);
 
+		// Enable super globals to prevent issues with the new \phpbb\request\request object
+		$request->enable_super_globals();
+		// Create a normal container now
+		$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
+
+		// Create cache
+		$cache = $phpbb_container->get('cache');
+
 		switch ($sub)
 		{
 			case 'intro':
@@ -418,6 +426,7 @@ class install_convert extends module
 			{
 				$error[] = sprintf($lang['TABLE_PREFIX_SAME'], $src_table_prefix);
 			}
+			$src_dbms  = phpbb_convert_30_dbms_to_31($src_dbms);
 
 			// Check table prefix
 			if (!sizeof($error))
@@ -1537,7 +1546,7 @@ class install_convert extends module
 	function finish_conversion()
 	{
 		global $db, $phpbb_root_path, $phpEx, $convert, $config, $language, $user, $template;
-		global $cache, $auth;
+		global $cache, $auth, $phpbb_container, $phpbb_log;
 
 		$db->sql_query('DELETE FROM ' . CONFIG_TABLE . "
 			WHERE config_name = 'convert_progress'
@@ -1550,6 +1559,7 @@ class install_convert extends module
 		phpbb_cache_moderators($db, $cache, $auth);
 
 		// And finally, add a note to the log
+		$phpbb_log = $phpbb_container->get('log');
 		add_log('admin', 'LOG_INSTALL_CONVERTED', $convert->convertor_data['forum_name'], $config['version']);
 
 		$url = $this->p_master->module_url . "?mode={$this->mode}&amp;sub=final&amp;language=$language";