Suppress logging of DB errors when checking if blog is installed. see #5771
git-svn-id: http://svn.automattic.com/wordpress/trunk@7269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f89ff6c5a0
commit
eda7e0e8bc
|
@ -957,9 +957,9 @@ function is_blog_installed() {
|
|||
if ( wp_cache_get('is_blog_installed') )
|
||||
return true;
|
||||
|
||||
$show = $wpdb->hide_errors();
|
||||
$suppress = $wpdb->suppress_errors();
|
||||
$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
|
||||
$wpdb->show_errors($show);
|
||||
$wpdb->suppress_errors($suppress);
|
||||
|
||||
$installed = !empty( $installed ) ? true : false;
|
||||
wp_cache_set('is_blog_installed', $installed);
|
||||
|
|
|
@ -17,6 +17,7 @@ if (!defined('SAVEQUERIES'))
|
|||
class wpdb {
|
||||
|
||||
var $show_errors = false;
|
||||
var $suppress_errors = false;
|
||||
var $num_queries = 0;
|
||||
var $last_query;
|
||||
var $col_info;
|
||||
|
@ -177,13 +178,18 @@ class wpdb {
|
|||
|
||||
function print_error($str = '') {
|
||||
global $EZSQL_ERROR;
|
||||
|
||||
if (!$str) $str = mysql_error($this->dbh);
|
||||
$EZSQL_ERROR[] =
|
||||
array ('query' => $this->last_query, 'error_str' => $str);
|
||||
|
||||
if ( $this->suppress_errors )
|
||||
return false;
|
||||
|
||||
$error_str = "WordPress database error $str for query $this->last_query";
|
||||
if ( $caller = $this->get_caller() )
|
||||
$error_str .= " made by $caller";
|
||||
|
||||
@error_log($error_str, 0);
|
||||
|
||||
// Is error output turned on or not..
|
||||
|
@ -215,6 +221,12 @@ class wpdb {
|
|||
return $show;
|
||||
}
|
||||
|
||||
function suppress_errors( $suppress = true ) {
|
||||
$errors = $this->suppress_errors;
|
||||
$this->suppress_errors = $suppress;
|
||||
return $errors;
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
// Kill cached query results
|
||||
|
||||
|
|
Loading…
Reference in New Issue