Changeset 36433
- Timestamp:
- 02/02/2016 12:12:28 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r36385 r36433 3094 3094 } 3095 3095 3096 3097 /** 3098 * Closes the current database connection. 3099 * 3100 * @since 4.5.0 3101 * 3102 * @return bool True if the connection was succesfully closed, false if it wasn't, or the connection doesn't exist. 3103 */ 3104 public function close() { 3105 if ( ! $this->dbh ) { 3106 return false; 3107 } 3108 3109 if ( $this->use_mysqli ) { 3110 $closed = mysqli_close( $this->dbh ); 3111 } else { 3112 $closed = mysql_close( $this->dbh ); 3113 } 3114 3115 if ( $closed ) { 3116 $this->dbh = null; 3117 } 3118 3119 return $closed; 3120 } 3121 3096 3122 /** 3097 3123 * Whether MySQL database is at least the required minimum version. -
trunk/tests/phpunit/tests/db.php
r35242 r36433 942 942 $this->assertNull( $row ); 943 943 } 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 } 944 960 }
Note: See TracChangeset
for help on using the changeset viewer.