Ticket #33926: 33926-db.patch
File 33926-db.patch, 964 bytes (added by , 8 years ago) |
---|
-
src/wp-includes/wp-db.php
1541 1541 */ 1542 1542 public function check_connection( $allow_bail = true ) { 1543 1543 if ( $this->use_mysqli ) { 1544 if ( @mysqli_ping( $this->dbh ) ) {1544 if ( !empty( $this->dbh ) && @mysqli_ping( $this->dbh ) ) { 1545 1545 return true; 1546 1546 } 1547 1547 } else { 1548 if ( @mysql_ping( $this->dbh ) ) {1548 if ( !empty( $this->dbh ) && @mysql_ping( $this->dbh ) ) { 1549 1549 return true; 1550 1550 } 1551 1551 } … … 1651 1651 // Keep track of the last query for debug.. 1652 1652 $this->last_query = $query; 1653 1653 1654 // Try to reconnect if the db handle is empty to avoid catchable fatal error. 1655 if ( empty( $this->dbh ) && !$this->check_connection() ) { 1656 $this->insert_id = 0; 1657 return false; 1658 } 1659 1654 1660 $this->_do_query( $query ); 1655 1661 1656 1662 // MySQL server has gone away, try to reconnect