diff options
Diffstat (limited to 'phpBB/install')
-rw-r--r-- | phpBB/install/convertors/functions_phpbb20.php | 53 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 19 | ||||
-rw-r--r-- | phpBB/install/install_convert.php | 49 | ||||
-rwxr-xr-x | phpBB/install/install_install.php | 1 |
4 files changed, 27 insertions, 95 deletions
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 1f62d80852..d503f66939 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -90,12 +90,9 @@ function phpbb_insert_forums() $src_db->sql_query("SET NAMES 'utf8'"); } - switch ($db->sql_layer) + if ($db->dbms_type == 'mssql') { - case 'mssql': - case 'mssql_odbc': - $db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' ON'); - break; + $db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' ON'); } $cats_added = array(); @@ -282,14 +279,13 @@ function phpbb_insert_forums() } $src_db->sql_freeresult($result); - switch ($db->sql_layer) + switch ($db->dbms_type) { case 'postgres': $db->sql_query("SELECT SETVAL('" . FORUMS_TABLE . "_seq',(select case when max(forum_id)>0 then max(forum_id)+1 else 1 end from " . FORUMS_TABLE . '));'); break; case 'mssql': - case 'mssql_odbc': $db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' OFF'); break; @@ -1702,41 +1698,9 @@ function phpbb_check_username_collisions() { global $db, $src_db, $convert, $table_prefix, $user, $lang; - $map_dbms = ''; - switch ($db->sql_layer) - { - case 'mysql': - $map_dbms = 'mysql_40'; - break; - - case 'mysql4': - if (version_compare($db->mysql_version, '4.1.3', '>=')) - { - $map_dbms = 'mysql_41'; - } - else - { - $map_dbms = 'mysql_40'; - } - break; - - case 'mysqli': - $map_dbms = 'mysql_41'; - break; - - case 'mssql': - case 'mssql_odbc': - $map_dbms = 'mssql'; - break; - - default: - $map_dbms = $db->sql_layer; - break; - } - // create a temporary table in which we store the clean usernames $drop_sql = 'DROP TABLE ' . $table_prefix . 'userconv'; - switch ($map_dbms) + switch ($db->dbms_type) { case 'firebird': $create_sql = 'CREATE TABLE ' . $table_prefix . 'userconv ( @@ -1752,14 +1716,7 @@ function phpbb_check_username_collisions() )'; break; - case 'mysql_40': - $create_sql = 'CREATE TABLE ' . $table_prefix . 'userconv ( - user_id mediumint(8) NOT NULL, - username_clean blob NOT NULL - )'; - break; - - case 'mysql_41': + case 'mysql': $create_sql = 'CREATE TABLE ' . $table_prefix . 'userconv ( user_id mediumint(8) NOT NULL, username_clean varchar(255) DEFAULT \'\' NOT NULL diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index d7cbfea28f..40666c29dc 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -340,21 +340,7 @@ $database_update_info = array( ); // Determine mapping database type -switch ($db->sql_layer) -{ - - case 'mysqli': - $map_dbms = 'mysql'; - break; - - case 'mssql_odbc': - $map_dbms = 'mssql'; - break; - - default: - $map_dbms = $db->sql_layer; - break; -} +$map_dbms = $db->dbms_type; $error_ary = array(); $errored = false; @@ -624,10 +610,9 @@ _sql($sql, $errored, $error_ary); /* Optimize/vacuum analyze the tables where appropriate // this should be done for each version in future along with // the version number update -switch ($db->sql_layer) +switch ($db->dbms_type) { case 'mysql': - case 'mysqli': $sql = 'OPTIMIZE TABLE ' . $table_prefix . 'auth_access, ' . $table_prefix . 'banlist, ' . $table_prefix . 'categories, ' . $table_prefix . 'config, ' . $table_prefix . 'disallow, ' . $table_prefix . 'forum_prune, ' . $table_prefix . 'forums, ' . $table_prefix . 'groups, ' . $table_prefix . 'posts, ' . $table_prefix . 'posts_text, ' . $table_prefix . 'privmsgs, ' . $table_prefix . 'privmsgs_text, ' . $table_prefix . 'ranks, ' . $table_prefix . 'search_results, ' . $table_prefix . 'search_wordlist, ' . $table_prefix . 'search_wordmatch, ' . $table_prefix . 'sessions_keys' . $table_prefix . 'smilies, ' . $table_prefix . 'themes, ' . $table_prefix . 'themes_name, ' . $table_prefix . 'topics, ' . $table_prefix . 'topics_watch, ' . $table_prefix . 'user_group, ' . $table_prefix . 'users, ' . $table_prefix . 'vote_desc, ' . $table_prefix . 'vote_results, ' . $table_prefix . 'vote_voters, ' . $table_prefix . 'words'; _sql($sql, $errored, $error_ary); break; diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 2fb34aee1d..7c7569c3f9 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -238,18 +238,15 @@ class install_convert extends module )); } - switch ($db->sql_layer) + if ($db->truncate) { - case 'sqlite': - case 'firebird': - $db->sql_query('DELETE FROM ' . SESSIONS_KEYS_TABLE); - $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); - break; - - default: - $db->sql_query('TRUNCATE TABLE ' . SESSIONS_KEYS_TABLE); - $db->sql_query('TRUNCATE TABLE ' . SESSIONS_TABLE); - break; + $db->sql_query('TRUNCATE TABLE ' . SESSIONS_KEYS_TABLE); + $db->sql_query('TRUNCATE TABLE ' . SESSIONS_TABLE); + } + else + { + $db->sql_query('DELETE FROM ' . SESSIONS_KEYS_TABLE); + $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); } break; @@ -684,7 +681,6 @@ class install_convert extends module // Thanks MySQL, for silently converting... case 'mysql': - case 'mysql4': if (version_compare($src_db->mysql_version, '4.1.3', '>=')) { $convert->mysql_convert = true; @@ -707,16 +703,13 @@ class install_convert extends module $src_db->sql_query("SET NAMES 'binary'"); } - switch ($db->sql_layer) + if ($db->truncate) { - case 'sqlite': - case 'firebird': - $convert->truncate_statement = 'DELETE FROM '; - break; - - default: - $convert->truncate_statement = 'TRUNCATE TABLE '; - break; + $convert->truncate_statement = 'TRUNCATE TABLE '; + } + else + { + $convert->truncate_statement = 'DELETE FROM '; } $get_info = false; @@ -1107,7 +1100,7 @@ class install_convert extends module if (!empty($schema['autoincrement'])) { - switch ($db->sql_layer) + switch ($db->dbms_type) { case 'postgres': $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $schema['autoincrement'] . ")>0 then max(" . $schema['autoincrement'] . ")+1 else 1 end from " . $schema['target'] . '));'); @@ -1244,10 +1237,9 @@ class install_convert extends module if (!empty($schema['autoincrement'])) { - switch ($db->sql_layer) + switch ($db->dbms_type) { case 'mssql': - case 'mssql_odbc': $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' ON'); break; } @@ -1276,12 +1268,10 @@ class install_convert extends module if ($sql_flag === true) { - switch ($db->sql_layer) + switch ($db->dbms_type) { // If MySQL, we'll wait to have num_wait_rows rows to submit at once case 'mysql': - case 'mysql4': - case 'mysqli': $waiting_rows[] = '(' . implode(', ', $insert_values) . ')'; if (sizeof($waiting_rows) >= $convert->num_wait_rows) @@ -1371,10 +1361,9 @@ class install_convert extends module if (!empty($schema['autoincrement'])) { - switch ($db->sql_layer) + switch ($db->dbms_type) { case 'mssql': - case 'mssql_odbc': $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' OFF'); break; @@ -1780,7 +1769,7 @@ class install_convert extends module global $convert; // Can we use IGNORE with this DBMS? - $sql_ignore = (strpos($db->sql_layer, 'mysql') === 0 && !defined('DEBUG_EXTRA')) ? 'IGNORE ' : ''; + $sql_ignore = ($db->dbms_type === 'mysql' && !defined('DEBUG_EXTRA')) ? 'IGNORE ' : ''; $insert_query = 'INSERT ' . $sql_ignore . 'INTO ' . $schema['target'] . ' ('; $aliases = array(); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index d91d67a065..4be58ed157 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1193,6 +1193,7 @@ class install_install extends module { case 'mssql': case 'mssql_odbc': + case 'mssql_2005': $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query); break; |