diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index a558fe6712..8a92c06e04 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -510,6 +510,12 @@ class acp_main $template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002)); } + // Fill dbms version if not yet filled + if (empty($config['dbms_version'])) + { + set_config('dbms_version', $db->sql_server_info(true)); + } + $this->tpl_name = 'acp_main'; $this->page_title = 'ACP_MAIN'; } diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 1b14bd56f6..601f1be38b 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -311,9 +311,6 @@ class phpbb_db_tools $this->sql_layer = $this->db->sql_layer; break; } - - // Because we only need the dbms type map of one database type, we "adjust" it now. ;) - $this->dbms_type_map = $this->dbms_type_map[$this->sql_layer]; } /** @@ -877,55 +874,37 @@ class phpbb_db_tools if (strpos($column_data[0], ':') !== false) { list($orig_column_type, $column_length) = explode(':', $column_data[0]); - - if (!is_array($this->dbms_type_map[$orig_column_type . ':'])) + if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'])) { - $column_type = sprintf($this->db->dbms_type_map[$orig_column_type . ':'], $column_length); - } - - $orig_column_type .= ':'; - } - else - { - $orig_column_type = $column_data[0]; - $column_type = $this->db->dbms_type_map[$column_data[0]]; - } - - // Get type - if (strpos($column_data[0], ':') !== false) - { - list($orig_column_type, $column_length) = explode(':', $column_data[0]); - if (!is_array($this->dbms_type_map[$orig_column_type . ':'])) - { - $column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'], $column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length); } else { - if (isset($this->dbms_type_map[$orig_column_type . ':']['rule'])) + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'])) { - switch ($this->dbms_type_map[$orig_column_type . ':']['rule'][0]) + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][0]) { case 'div': - $column_length /= $this->dbms_type_map[$orig_column_type . ':']['rule'][1]; + $column_length /= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][1]; $column_length = ceil($column_length); - $column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'][0], $column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); break; } } - if (isset($this->dbms_type_map[$orig_column_type . ':']['limit'])) + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'])) { - switch ($this->dbms_type_map[$orig_column_type . ':']['limit'][0]) + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][0]) { case 'mult': - $column_length *= $this->dbms_type_map[$orig_column_type . ':']['limit'][1]; - if ($column_length > $this->dbms_type_map[$orig_column_type . ':']['limit'][2]) + $column_length *= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][1]; + if ($column_length > $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][2]) { - $column_type = $this->dbms_type_map[$orig_column_type . ':']['limit'][3]; + $column_type = $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][3]; } else { - $column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'][0], $column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); } break; } @@ -936,7 +915,7 @@ class phpbb_db_tools else { $orig_column_type = $column_data[0]; - $column_type = $this->dbms_type_map[$column_data[0]]; + $column_type = $this->dbms_type_map[$this->sql_layer][$column_data[0]]; } // Adjust default value if db-dependant specified diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 82d20e90a7..3cdf18449d 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -502,7 +502,7 @@ function user_delete($mode, $user_id, $post_username = false) $cache->destroy('sql', MODERATOR_CACHE_TABLE); // Delete the user_id from the banlist - $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' WHERE ban_userid = ' . $user_id; $db->sql_query($sql); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index d2c4641112..ea87847fa2 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -183,6 +183,12 @@ class install_update extends module ); } + // Fill DB version + if (empty($config['dbms_version'])) + { + set_config('dbms_version', $db->sql_server_info(true)); + } + if ($this->test_update === false) { // Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present