WordPress.org

Make WordPress Core

Changeset 27925


Ignore:
Timestamp:
04/03/2014 04:05:31 AM (8 years ago)
Author:
nacin
Message:

Database: Add $allow_bail argument to wpdb::check_connection() to match the connect method.

props DrProtocols, pento.
fixes #27240.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r27503 r27925  
    13871387     * @since 3.9.0
    13881388     *
     1389     * @param bool $allow_bail Optional. Allows the function to bail, default true. If this is set
     1390     *                         to false, you will need to handle the lack of database connection
     1391     *                         manually.
     1392     *
    13891393     * @return bool True if the connection is up.
    13901394     */
    1391     function check_connection() {
     1395    function check_connection( $allow_bail = true ) {
    13921396        if ( $this->use_mysqli ) {
    13931397            if ( @mysqli_ping( $this->dbh ) ) {
     
    14291433        // Let's just return and hope for the best.
    14301434        if ( did_action( 'template_redirect' ) ) {
     1435            return false;
     1436        }
     1437
     1438        if ( ! $allow_bail ) {
    14311439            return false;
    14321440        }
Note: See TracChangeset for help on using the changeset viewer.