Display mysql_connect errors when WP_DEBUG is enabled. Fixes #14654 props lloydbudd and hakre
Always die if we can't connect to the db no point in going any futher. git-svn-id: http://svn.automattic.com/wordpress/trunk@15808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9a0595f302
commit
1bc8d5c12f
|
@ -1026,7 +1026,11 @@ class wpdb {
|
||||||
function db_connect() {
|
function db_connect() {
|
||||||
global $db_list, $global_db_list;
|
global $db_list, $global_db_list;
|
||||||
|
|
||||||
|
if ( WP_DEBUG ) {
|
||||||
|
$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true );
|
||||||
|
} else {
|
||||||
$this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true );
|
$this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !$this->dbh ) {
|
if ( !$this->dbh ) {
|
||||||
$this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"
|
$this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"
|
||||||
|
@ -1039,6 +1043,9 @@ class wpdb {
|
||||||
</ul>
|
</ul>
|
||||||
<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
|
<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
|
||||||
"/*/WP_I18N_DB_CONN_ERROR*/, $this->dbhost ), 'db_connect_fail' );
|
"/*/WP_I18N_DB_CONN_ERROR*/, $this->dbhost ), 'db_connect_fail' );
|
||||||
|
|
||||||
|
//If show errors is disabled then we need to die anyway as we don't have a working DB connection
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->set_charset( $this->dbh );
|
$this->set_charset( $this->dbh );
|
||||||
|
|
Loading…
Reference in New Issue