Minor fix to DatabaseBase::close() logic
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 16 May 2014 18:22:31 +0000 (11:22 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 16 May 2014 18:34:17 +0000 (18:34 +0000)
* Only set mOpened to false if closeConnection() was called (or mConn was unset)

bug: 65100
Change-Id: I1ba6b765cfc647a47f21048d993047c0fe0cfe19

includes/db/Database.php

index 286f8b0..13efb81 100644 (file)
@@ -926,7 +926,6 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
                if ( count( $this->mTrxIdleCallbacks ) ) { // sanity
                        throw new MWException( "Transaction idle callbacks still pending." );
                }
-               $this->mOpened = false;
                if ( $this->mConn ) {
                        if ( $this->trxLevel() ) {
                                if ( !$this->mTrxAutomatic ) {
@@ -937,13 +936,14 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
                                $this->commit( __METHOD__, 'flush' );
                        }
 
-                       $ret = $this->closeConnection();
+                       $closed = $this->closeConnection();
                        $this->mConn = false;
-
-                       return $ret;
                } else {
-                       return true;
+                       $closed = true;
                }
+               $this->mOpened = false;
+
+               return $closed;
        }
 
        /**