Make WordPress Core

Ticket #5932: 5932.8.diff

File 5932.8.diff, 1.1 KB (added by pento, 10 years ago)
  • src/wp-includes/wp-db.php

     
    13711371        /**
    13721372         * Check that the connection to the database is still up. If not, try to reconnect.
    13731373         *
    1374          * If this function is unable to reconnect, it will forcibly die.
     1374         * If this function is unable to reconnect, it will forcibly die before wp_head has been
     1375         * triggered, or return false after wp_head has been triggered.
    13751376         *
    13761377         * @since 3.9.0
    13771378         *
     
    14141415                        sleep( 1 );
    14151416                }
    14161417
     1418                // If wp_head has already happened, wp_die()/dead_db() won't work properly,
     1419                // so let's just return and hope for the best.
     1420                if ( did_action( 'wp_head' ) ) {
     1421                        return false;
     1422                }
     1423
    14171424                // We weren't able to reconnect, so we better bail.
    14181425                $this->bail( sprintf( ( "
    14191426<h1>Error reconnecting to the database</h1>
     
    14791486                if ( empty( $this->dbh ) || 2006 == $mysql_errno ) {
    14801487                        if ( $this->check_connection() ) {
    14811488                                $this->_do_query( $query );
     1489                        } else {
     1490                                $this->insert_id = 0;
     1491                                return false;
    14821492                        }
    14831493                }
    14841494