From: Aaron Schulz Date: Fri, 16 May 2014 17:50:05 +0000 (-0700) Subject: Avoid fatals in begin/commit/rollback if close() was called X-Git-Tag: 1.31.0-rc.0~15666^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=3f495e45193014a7a84234a3f50b439488fa95ea;p=lhc%2Fweb%2Fwiklou.git Avoid fatals in begin/commit/rollback if close() was called Change-Id: I3c555ece5c1e16c6ffcdbec6645d659531400a1b --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 286f8b0b96..5212d3c855 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -3417,6 +3417,11 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { $this->runOnTransactionIdleCallbacks(); } + # Avoid fatals if close() was called + if ( !$this->isOpen() ) { + throw new DBUnexpectedError( $this, "DB connection was already closed." ); + } + $this->doBegin( $fname ); $this->mTrxFname = $fname; $this->mTrxDoneWrites = false; @@ -3475,6 +3480,11 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { } } + # Avoid fatals if close() was called + if ( !$this->isOpen() ) { + throw new DBUnexpectedError( $this, "DB connection was already closed." ); + } + $this->runOnTransactionPreCommitCallbacks(); $this->doCommit( $fname ); if ( $this->mTrxDoneWrites ) { @@ -3525,6 +3535,11 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { } } + # Avoid fatals if close() was called + if ( !$this->isOpen() ) { + throw new DBUnexpectedError( $this, "DB connection was already closed." ); + } + $this->doRollback( $fname ); $this->mTrxIdleCallbacks = array(); // cancel $this->mTrxPreCommitCallbacks = array(); // cancel