Make WordPress Core


Ignore:
Timestamp:
02/02/2016 12:12:28 AM (9 years ago)
Author:
pento
Message:

WPDB: Add a close() method to wpdb, for when the connection needs to be manually closed.

In the event that it was closed prematurely, wpdb::query() will re-open the connection automatically.

Fixes #34903.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/db.php

    r35242 r36433  
    942942        $this->assertNull( $row );
    943943    }
     944
     945    /**
     946     * @ticket 34903
     947     */
     948    function test_close() {
     949        global $wpdb;
     950
     951        $this->assertTrue( $wpdb->close() );
     952        $this->assertFalse( $wpdb->close() );
     953
     954        $wpdb->check_connection();
     955
     956        $this->assertTrue( $wpdb->close() );
     957
     958        $wpdb->check_connection();
     959    }
    944960}
Note: See TracChangeset for help on using the changeset viewer.