From 1045fdf3121381e91b9d2b3c5a30ea5b2e9c0811 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 25 Jun 2014 10:12:44 -0700 Subject: [PATCH] Made DB commit() method properly bail out if no trx is active * Also flipped conditional to avoid being in the negative Change-Id: I30bce9a015bea5909322bba93493500b5b418d18 --- includes/db/Database.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index 7bbcc2ffe4..32a2ca857c 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -3467,17 +3467,18 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { ); } - if ( $flush !== 'flush' ) { + if ( $flush === 'flush' ) { if ( !$this->mTrxLevel ) { - wfWarn( "$fname: No transaction to commit, something got out of sync!" ); - } elseif ( $this->mTrxAutomatic ) { - wfWarn( "$fname: Explicit commit of implicit transaction. Something may be out of sync!" ); + return; // nothing to do + } elseif ( !$this->mTrxAutomatic ) { + wfWarn( "$fname: Flushing an explicit transaction, getting out of sync!" ); } } else { if ( !$this->mTrxLevel ) { + wfWarn( "$fname: No transaction to commit, something got out of sync!" ); return; // nothing to do - } elseif ( !$this->mTrxAutomatic ) { - wfWarn( "$fname: Flushing an explicit transaction, getting out of sync!" ); + } elseif ( $this->mTrxAutomatic ) { + wfWarn( "$fname: Explicit commit of implicit transaction. Something may be out of sync!" ); } } -- 2.20.1