クラス wpdb::print_error()
wpdb::print_error()
クラス
定義ファイル :/blog/wp-includes/wp-db.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | public function print_error( $str = '' ) { global $EZSQL_ERROR; if ( !$str ) { if ( $this->use_mysqli ) { $str = mysqli_error( $this->dbh ); } else { $str = mysql_error( $this->dbh ); } } $EZSQL_ERROR[] = array( 'query' => $this->last_query, 'error_str' => $str ); if ( $this->suppress_errors ) return false; wp_load_translations_early(); if ( $caller = $this->get_caller() ) $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s made by %3$s' ), $str, $this->last_query, $caller ); else $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s' ), $str, $this->last_query ); error_log( $error_str ); // Are we showing errors? if ( ! $this->show_errors ) return false; // If there is an error then take note of it if ( is_multisite() ) { $msg = "WordPress database error: [$str]\n{$this->last_query}\n"; if ( defined( 'ERRORLOGFILE' ) ) error_log( $msg, 3, ERRORLOGFILE ); if ( defined( 'DIEONDBERROR' ) ) wp_die( $msg ); } else { $str = htmlspecialchars( $str, ENT_QUOTES ); $query = htmlspecialchars( $this->last_query, ENT_QUOTES ); print "<div id='error'> <p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br /> $query</code></p> </div>"; } } |