Make WordPress Core

Changeset 7269


Ignore:
Timestamp:
03/12/2008 10:41:43 PM (17 years ago)
Author:
ryan
Message:

Suppress logging of DB errors when checking if blog is installed. see #5771

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r7134 r7269  
    958958        return true;
    959959
    960     $show = $wpdb->hide_errors();
     960    $suppress = $wpdb->suppress_errors();
    961961    $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
    962     $wpdb->show_errors($show);
     962    $wpdb->suppress_errors($suppress);
    963963
    964964    $installed = !empty( $installed ) ? true : false;
  • trunk/wp-includes/wp-db.php

    r7037 r7269  
    1818
    1919    var $show_errors = false;
     20    var $suppress_errors = false;
    2021    var $num_queries = 0;
    2122    var $last_query;
     
    178179    function print_error($str = '') {
    179180        global $EZSQL_ERROR;
     181
    180182        if (!$str) $str = mysql_error($this->dbh);
    181183        $EZSQL_ERROR[] =
    182184        array ('query' => $this->last_query, 'error_str' => $str);
    183185
     186        if ( $this->suppress_errors )
     187            return false;
     188
    184189        $error_str = "WordPress database error $str for query $this->last_query";
    185190        if ( $caller = $this->get_caller() )
    186191            $error_str .= " made by $caller";
     192       
    187193        @error_log($error_str, 0);
    188194
     
    214220        $this->show_errors = false;
    215221        return $show;
     222    }
     223
     224    function suppress_errors( $suppress = true ) {
     225        $errors = $this->suppress_errors;
     226        $this->suppress_errors = $suppress;
     227        return $errors;
    216228    }
    217229
Note: See TracChangeset for help on using the changeset viewer.