[ticket/11031] Fix container construction and missing objects

PHPBB3-11031
This commit is contained in:
Joas Schilling 2013-10-23 21:13:25 +02:00
parent d612041cd1
commit 6dd4620609

View file

@ -90,13 +90,21 @@ class install_convert extends module
function main($mode, $sub) function main($mode, $sub)
{ {
global $lang, $template, $phpbb_root_path, $phpEx, $cache, $config, $language, $table_prefix; 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->tpl_name = 'install_convert';
$this->mode = $mode; $this->mode = $mode;
$convert = new convert($this->p_master); $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) switch ($sub)
{ {
case 'intro': case 'intro':
@ -418,6 +426,7 @@ class install_convert extends module
{ {
$error[] = sprintf($lang['TABLE_PREFIX_SAME'], $src_table_prefix); $error[] = sprintf($lang['TABLE_PREFIX_SAME'], $src_table_prefix);
} }
$src_dbms = phpbb_convert_30_dbms_to_31($src_dbms);
// Check table prefix // Check table prefix
if (!sizeof($error)) if (!sizeof($error))
@ -1537,7 +1546,7 @@ class install_convert extends module
function finish_conversion() function finish_conversion()
{ {
global $db, $phpbb_root_path, $phpEx, $convert, $config, $language, $user, $template; 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 . " $db->sql_query('DELETE FROM ' . CONFIG_TABLE . "
WHERE config_name = 'convert_progress' WHERE config_name = 'convert_progress'
@ -1550,6 +1559,7 @@ class install_convert extends module
phpbb_cache_moderators($db, $cache, $auth); phpbb_cache_moderators($db, $cache, $auth);
// And finally, add a note to the log // 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']); add_log('admin', 'LOG_INSTALL_CONVERTED', $convert->convertor_data['forum_name'], $config['version']);
$url = $this->p_master->module_url . "?mode={$this->mode}&sub=final&language=$language"; $url = $this->p_master->module_url . "?mode={$this->mode}&sub=final&language=$language";