Abort if there are no active transactions
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 6 May 2013 12:09:46 +0000 (14:09 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 6 May 2013 12:09:46 +0000 (14:09 +0200)
wcfsetup/install/files/lib/system/database/Database.class.php

index 4234cac5346cd44dc6bd5845387e6dcc8367bc4c..c4c21cfbf23f10d5201bb8f82d3622ba05ec6b30 100644 (file)
@@ -153,6 +153,8 @@ abstract class Database {
         * @return      boolean
         */
        public function commitTransaction() {
+               if ($this->activeTransactions === 0) return false;
+               
                try {
                        $this->activeTransactions--;
                        
@@ -180,9 +182,10 @@ abstract class Database {
         * @return      boolean
         */
        public function rollBackTransaction() {
+               if ($this->activeTransactions === 0) return false;
+               
                try {
                        $this->activeTransactions--;
-                       
                        if ($this->activeTransactions === 0) {
                                if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start("ROLLBACK", Benchmark::TYPE_SQL_QUERY);
                                $result = $this->pdo->rollback();