Merge "kafka: Implement ack handling"
[lhc/web/wiklou.git] / includes / db / Database.php
index 8807e13..6bdcb24 100644 (file)
@@ -2561,11 +2561,7 @@ abstract class DatabaseBase implements IDatabase {
                }
        }
 
-       final public function doAtomicSection( $fname, $callback ) {
-               if ( !is_callable( $callback ) ) {
-                       throw new UnexpectedValueException( "Invalid callback." );
-               };
-
+       final public function doAtomicSection( $fname, callable $callback ) {
                $this->startAtomic( $fname );
                try {
                        call_user_func_array( $callback, [ $this, $fname ] );
@@ -2589,17 +2585,13 @@ abstract class DatabaseBase implements IDatabase {
                        } elseif ( !$this->mTrxAutomatic ) {
                                // We want to warn about inadvertently nested begin/commit pairs, but not about
                                // auto-committing implicit transactions that were started by query() via DBO_TRX
-                               $msg = "$fname: Transaction already in progress (from {$this->mTrxFname}), " .
-                                       " performing implicit commit!";
-                               wfWarn( $msg );
-                               wfLogDBError( $msg,
-                                       $this->getLogContext( [
-                                               'method' => __METHOD__,
-                                               'fname' => $fname,
-                                       ] )
+                               throw new DBUnexpectedError(
+                                       $this,
+                                       "$fname: Transaction already in progress (from {$this->mTrxFname}), " .
+                                               " performing implicit commit!"
                                );
                        } else {
-                               // if the transaction was automatic and has done write operations
+                               // The transaction was automatic and has done write operations
                                if ( $this->mTrxDoneWrites ) {
                                        wfDebug( "$fname: Automatic transaction with writes in progress" .
                                                " (from {$this->mTrxFname}), performing implicit commit!\n"