Database: Suppress connection error messages when `WP_DEBUG` isn't enabled.
This is a partial revert of [35860], which has been causing un-catchable warnings to be generated on some server configurations. Fixes #36629 for trunk. See #21870. Built from https://develop.svn.wordpress.org/trunk@37292 git-svn-id: http://core.svn.wordpress.org/trunk@37258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c3fe61770c
commit
b45e906927
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.6-alpha-37288';
|
$wp_version = '4.6-alpha-37292';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
|
@ -1486,7 +1486,11 @@ class wpdb {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
|
if ( WP_DEBUG ) {
|
||||||
|
mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
|
||||||
|
} else {
|
||||||
|
@mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
|
||||||
|
}
|
||||||
|
|
||||||
if ( $this->dbh->connect_errno ) {
|
if ( $this->dbh->connect_errno ) {
|
||||||
$this->dbh = null;
|
$this->dbh = null;
|
||||||
|
@ -1512,7 +1516,11 @@ class wpdb {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
|
if ( WP_DEBUG ) {
|
||||||
|
$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
|
||||||
|
} else {
|
||||||
|
$this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $this->dbh && $allow_bail ) {
|
if ( ! $this->dbh && $allow_bail ) {
|
||||||
|
|
Loading…
Reference in New Issue