mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Assume WP_DEBUG is defined in wpdb. Remove unnecessary constant() calls. Ensure DB_COLLATE defined as empty string doesn't override default Multisite collation. fixes #12041, see #11644
git-svn-id: https://develop.svn.wordpress.org/trunk@13209 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -345,7 +345,7 @@ class wpdb {
|
||||
* @param string $dbhost MySQL database host
|
||||
*/
|
||||
function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
|
||||
if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true )
|
||||
if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB )
|
||||
$this->db_connect();
|
||||
return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
|
||||
}
|
||||
@@ -367,23 +367,22 @@ class wpdb {
|
||||
function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
|
||||
register_shutdown_function(array(&$this, "__destruct"));
|
||||
|
||||
if ( defined( 'WP_DEBUG' ) && WP_DEBUG )
|
||||
if ( WP_DEBUG )
|
||||
$this->show_errors();
|
||||
|
||||
if ( is_multisite() ) {
|
||||
$this->charset = 'utf8';
|
||||
if ( defined( 'DB_COLLATE' ) && constant( 'DB_COLLATE' ) != '' )
|
||||
$this->collate = constant( 'DB_COLLATE' );
|
||||
if ( defined( 'DB_COLLATE' ) && DB_COLLATE )
|
||||
$this->collate = DB_COLLATE;
|
||||
else
|
||||
$this->collate = 'utf8_general_ci';
|
||||
} elseif ( defined( 'DB_COLLATE' ) ) {
|
||||
$this->collate = DB_COLLATE;
|
||||
}
|
||||
|
||||
if ( defined('DB_CHARSET') )
|
||||
$this->charset = DB_CHARSET;
|
||||
|
||||
if ( defined('DB_COLLATE') )
|
||||
$this->collate = DB_COLLATE;
|
||||
|
||||
$this->dbuser = $dbuser;
|
||||
|
||||
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
|
||||
@@ -666,7 +665,7 @@ class wpdb {
|
||||
if ( is_multisite() ) {
|
||||
$msg = "WordPress database error: [$str]\n{$this->last_query}\n";
|
||||
if ( defined( 'ERRORLOGFILE' ) )
|
||||
error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) );
|
||||
error_log( $msg, 3, ERRORLOGFILE );
|
||||
if ( defined( 'DIEONDBERROR' ) )
|
||||
die( $msg );
|
||||
} else {
|
||||
@@ -807,7 +806,7 @@ class wpdb {
|
||||
// use $this->dbh for read ops, and $this->dbhwrite for write ops
|
||||
// use $this->dbhglobal for gloal table ops
|
||||
unset( $dbh );
|
||||
if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) {
|
||||
if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB ) {
|
||||
if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
|
||||
if( false == isset( $this->dbhglobal ) ) {
|
||||
$this->db_connect( $query );
|
||||
|
||||
Reference in New Issue
Block a user