Changeset 35860
- Timestamp:
- 12/11/2015 03:39:52 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r35787 r35860 1045 1045 1046 1046 if ( $this->use_mysqli ) { 1047 $success = @mysqli_select_db( $dbh, $db );1047 $success = mysqli_select_db( $dbh, $db ); 1048 1048 } else { 1049 $success = @mysql_select_db( $db, $dbh );1049 $success = mysql_select_db( $db, $dbh ); 1050 1050 } 1051 1051 if ( ! $success ) { … … 1485 1485 } 1486 1486 1487 if ( WP_DEBUG ) { 1488 mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); 1489 } else { 1490 @mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); 1491 } 1487 mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); 1492 1488 1493 1489 if ( $this->dbh->connect_errno ) { … … 1515 1511 } 1516 1512 } else { 1517 if ( WP_DEBUG ) { 1518 $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); 1519 } else { 1520 $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); 1521 } 1513 $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); 1522 1514 } 1523 1515 … … 1590 1582 public function check_connection( $allow_bail = true ) { 1591 1583 if ( $this->use_mysqli ) { 1592 if ( @mysqli_ping( $this->dbh ) ) {1584 if ( ! empty( $this->dbh ) && mysqli_ping( $this->dbh ) ) { 1593 1585 return true; 1594 1586 } 1595 1587 } else { 1596 if ( @mysql_ping( $this->dbh ) ) {1588 if ( ! empty( $this->dbh ) && mysql_ping( $this->dbh ) ) { 1597 1589 return true; 1598 1590 } … … 1771 1763 $num_rows = 0; 1772 1764 if ( $this->use_mysqli && $this->result instanceof mysqli_result ) { 1773 while ( $row = @mysqli_fetch_object( $this->result ) ) {1765 while ( $row = mysqli_fetch_object( $this->result ) ) { 1774 1766 $this->last_result[$num_rows] = $row; 1775 1767 $num_rows++; 1776 1768 } 1777 1769 } elseif ( is_resource( $this->result ) ) { 1778 while ( $row = @mysql_fetch_object( $this->result ) ) {1770 while ( $row = mysql_fetch_object( $this->result ) ) { 1779 1771 $this->last_result[$num_rows] = $row; 1780 1772 $num_rows++; … … 1806 1798 } 1807 1799 1808 if ( $this->use_mysqli ) {1809 $this->result = @mysqli_query( $this->dbh, $query );1810 } else {1811 $this->result = @mysql_query( $query, $this->dbh );1800 if ( ! empty( $this->dbh ) && $this->use_mysqli ) { 1801 $this->result = mysqli_query( $this->dbh, $query ); 1802 } elseif ( ! empty( $this->dbh ) ) { 1803 $this->result = mysql_query( $query, $this->dbh ); 1812 1804 } 1813 1805 $this->num_queries++; … … 3017 3009 3018 3010 if ( $this->use_mysqli ) { 3019 $num_fields = @mysqli_num_fields( $this->result );3011 $num_fields = mysqli_num_fields( $this->result ); 3020 3012 for ( $i = 0; $i < $num_fields; $i++ ) { 3021 $this->col_info[ $i ] = @mysqli_fetch_field( $this->result );3013 $this->col_info[ $i ] = mysqli_fetch_field( $this->result ); 3022 3014 } 3023 3015 } else { 3024 $num_fields = @mysql_num_fields( $this->result );3016 $num_fields = mysql_num_fields( $this->result ); 3025 3017 for ( $i = 0; $i < $num_fields; $i++ ) { 3026 $this->col_info[ $i ] = @mysql_fetch_field( $this->result, $i );3018 $this->col_info[ $i ] = mysql_fetch_field( $this->result, $i ); 3027 3019 } 3028 3020 }
Note: See TracChangeset
for help on using the changeset viewer.