Ticket #745: 745c.diff
| File 745c.diff, 4.0 KB (added by mdawaffe, 6 years ago) |
|---|
-
bb-includes/classes.php
286 286 $fields .= ", MIN(p.post_id) as post_id"; 287 287 288 288 // GROUP_CONCAT requires MySQL >= 4.1 289 if ( version_compare('4.1', mysql_get_client_info(), '<=') )289 if ( version_compare('4.1', $bbdb->db_version(), '<=') ) 290 290 $fields .= ", GROUP_CONCAT(p.post_text SEPARATOR ' ') AS post_text"; 291 291 else 292 292 $fields .= ", p.post_text"; -
bb-includes/db-mysqli.php
1 1 <?php 2 2 3 define('BB_MYSQLI', true); 4 3 5 define('OBJECT', 'OBJECT', true); 4 6 define('ARRAY_A', 'ARRAY_A', false); 5 7 define('ARRAY_N', 'ARRAY_N', false); … … 77 79 78 80 $this->$dbhname = @mysqli_connect( $server->host, $server->user, $server->pass, null, $server->port ); 79 81 80 if ( !empty($this->charset) && version_compare(mysql _get_server_info(), '4.1.0', '>=') )82 if ( !empty($this->charset) && version_compare(mysqli_get_server_info($this->$dbhname), '4.1.0', '>=') ) 81 83 $this->query("SET NAMES '$this->charset'"); 82 84 83 85 $this->select( $server->database, $this->$dbhname ); … … 87 89 return $this->$dbhname; 88 90 } 89 91 92 function db_version( $dbh = false ) { // table name or mysql resource 93 if ( !$dbh ) 94 $dbh = $this->forums; 95 96 if ( !is_resource( $dbh ) ) 97 $dbh = $this->db_connect( "DESCRIBE $dbh" ); 98 99 return mysqli_get_server_info( $dbh ); 100 } 101 90 102 function get_table_from_query ( $q ) { 91 103 If( substr( $q, -1 ) == ';' ) 92 104 $q = substr( $q, 0, -1 ); -
bb-includes/db.php
1 1 <?php 2 2 3 define('BB_MYSQLI', false); 4 3 5 define('OBJECT', 'OBJECT', true); 4 6 define('ARRAY_A', 'ARRAY_A', false); 5 7 define('ARRAY_N', 'ARRAY_N', false); … … 80 82 return $this->$dbhname; 81 83 } 82 84 85 function db_version( $dbh = false ) { // table name or mysql resource 86 if ( !$dbh ) 87 $dbh = $this->forums; 88 89 if ( !is_resource( $dbh ) ) 90 $dbh = $this->db_connect( "DESCRIBE $dbh" ); 91 92 return mysql_get_server_info( $dbh ); 93 } 94 83 95 function get_table_from_query ( $q ) { 84 96 If( substr( $q, -1 ) == ';' ) 85 97 $q = substr( $q, 0, -1 ); -
bb-admin/upgrade-schema.php
2 2 global $bb_queries, $bbdb; 3 3 4 4 $charset_collate = ''; 5 $user_charset_collate = ''; 5 6 6 if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) { 7 if ( !defined( 'BB_MYSQLI' ) ) 8 die( __('Database class not loaded.') ); 9 10 if ( version_compare($bbdb->db_version(), '4.1.0', '>=') ) { 7 11 if ( ! empty($bbdb->charset) ) 8 12 $charset_collate = "DEFAULT CHARACTER SET $bbdb->charset"; 9 13 if ( ! empty($bbdb->collate) ) 10 14 $charset_collate .= " COLLATE $bbdb->collate"; 11 15 } 12 16 17 if ( version_compare($bbdb->db_version( $bbdb->users ), '4.1.0', '>=') ) { 18 if ( ! empty($bbdb->charset) ) 19 $user_charset_collate = "DEFAULT CHARACTER SET $bbdb->charset"; 20 if ( ! empty($bbdb->collate) ) 21 $user_charset_collate .= " COLLATE $bbdb->collate"; 22 } 23 13 24 $bb_queries = "CREATE TABLE $bbdb->forums ( 14 25 forum_id int(10) NOT NULL auto_increment, 15 26 forum_name varchar(150) NOT NULL default '', … … 79 90 display_name varchar(250) NOT NULL default '', 80 91 PRIMARY KEY (ID), 81 92 UNIQUE KEY user_login (user_login) 82 ) $ charset_collate;93 ) $user_charset_collate; 83 94 CREATE TABLE $bbdb->usermeta ( 84 95 umeta_id bigint(20) NOT NULL auto_increment, 85 96 user_id bigint(20) NOT NULL default '0', … … 88 99 PRIMARY KEY (umeta_id), 89 100 KEY user_id (user_id), 90 101 KEY meta_key (meta_key) 91 ) $ charset_collate;102 ) $user_charset_collate; 92 103 CREATE TABLE $bbdb->tags ( 93 104 tag_id bigint(20) unsigned NOT NULL auto_increment, 94 105 tag varchar(200) NOT NULL default '',