Merge "Make doAtomicSection() return the callback result"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 17 Aug 2016 23:01:12 +0000 (23:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 17 Aug 2016 23:01:12 +0000 (23:01 +0000)
includes/db/Database.php
includes/db/IDatabase.php

index d492def..940c3f7 100644 (file)
@@ -2658,12 +2658,14 @@ abstract class DatabaseBase implements IDatabase {
        final public function doAtomicSection( $fname, callable $callback ) {
                $this->startAtomic( $fname );
                try {
-                       call_user_func_array( $callback, [ $this, $fname ] );
+                       $res = call_user_func_array( $callback, [ $this, $fname ] );
                } catch ( Exception $e ) {
                        $this->rollback( $fname );
                        throw $e;
                }
                $this->endAtomic( $fname );
+
+               return $res;
        }
 
        final public function begin( $fname = __METHOD__, $mode = self::TRANSACTION_EXPLICIT ) {
index fce5aa8..772d824 100644 (file)
@@ -1347,6 +1347,7 @@ interface IDatabase {
         *
         * @param string $fname Caller name (usually __METHOD__)
         * @param callable $callback Callback that issues DB updates
+        * @return mixed $res Result of the callback (since 1.28)
         * @throws DBError
         * @throws RuntimeException
         * @throws UnexpectedValueException