diff options
Diffstat (limited to 'phpBB/install/install_install.php')
-rw-r--r-- | phpBB/install/install_install.php | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 576cbba3ca..b82df84a00 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -51,7 +51,7 @@ class install_install extends module function main($mode, $sub) { global $lang, $template, $language, $phpbb_root_path, $phpEx; - global $phpbb_container, $cache, $phpbb_log, $request; + global $phpbb_container, $cache, $phpbb_log, $request, $phpbb_config_php_file; switch ($sub) { @@ -104,7 +104,8 @@ class install_install extends module $request->enable_super_globals(); // Create a normal container now - $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->get_container(); // Sets the global variables $cache = $phpbb_container->get('cache'); @@ -1153,21 +1154,25 @@ class install_install extends module // How should we treat this schema? $delimiter = $available_dbms[$data['dbms']]['DELIM']; - $sql_query = @file_get_contents($dbms_schema); - $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query); - $sql_query = phpbb_remove_comments($sql_query); - $sql_query = split_sql_file($sql_query, $delimiter); - foreach ($sql_query as $sql) + if (file_exists($dbms_schema)) { - //$sql = trim(str_replace('|', ';', $sql)); - if (!$db->sql_query($sql)) + $sql_query = @file_get_contents($dbms_schema); + $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query); + $sql_query = phpbb_remove_comments($sql_query); + $sql_query = split_sql_file($sql_query, $delimiter); + + foreach ($sql_query as $sql) { - $error = $db->sql_error(); - $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); + //$sql = trim(str_replace('|', ';', $sql)); + if (!$db->sql_query($sql)) + { + $error = $db->sql_error(); + $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); + } } + unset($sql_query); } - unset($sql_query); // Ok we have the db info go ahead and work on building the table $db_table_schema = @file_get_contents('schemas/schema.json'); @@ -1528,10 +1533,10 @@ class install_install extends module $_module->update_module_data($module_data, true); // Check for last sql error happened - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } $categories[$cat_name]['id'] = (int) $module_data['module_id']; @@ -1562,10 +1567,10 @@ class install_install extends module $_module->update_module_data($module_data, true); // Check for last sql error happened - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } $categories[$level2_name]['id'] = (int) $module_data['module_id']; @@ -1602,10 +1607,10 @@ class install_install extends module $_module->update_module_data($module_data, true); // Check for last sql error happened - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } } } @@ -1768,10 +1773,10 @@ class install_install extends module $_module->update_module_data($module_data, true); // Check for last sql error happened - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } } } @@ -1820,10 +1825,10 @@ class install_install extends module $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $lang_pack)); $installed_languages[] = (int) $db->sql_nextid(); - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } } } @@ -1909,7 +1914,7 @@ class install_install extends module if (!$user_id) { // If we can't insert this user then continue to the next one to avoid inconsistent data - $this->p_master->db_error('Unable to insert bot into users table', $db->sql_error_sql, __LINE__, __FILE__, true); + $this->p_master->db_error('Unable to insert bot into users table', $db->get_sql_error_sql(), __LINE__, __FILE__, true); continue; } |