Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / includes / deferred / MWCallableUpdate.php
index 5b822af..9803b7a 100644 (file)
@@ -14,14 +14,18 @@ class MWCallableUpdate implements DeferrableUpdate, DeferrableCallback {
        /**
         * @param callable $callback
         * @param string $fname Calling method
-        * @param IDatabase|null $dbw Abort if this DB is rolled back [optional] (since 1.28)
+        * @param IDatabase|IDatabase[]|null $dbws Abort if any of the specified DB handles have
+        *   a currently pending transaction which later gets rolled back [optional] (since 1.28)
         */
-       public function __construct( callable $callback, $fname = 'unknown', IDatabase $dbw = null ) {
+       public function __construct( callable $callback, $fname = 'unknown', $dbws = [] ) {
                $this->callback = $callback;
                $this->fname = $fname;
 
-               if ( $dbw && $dbw->trxLevel() ) {
-                       $dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ], $fname );
+               $dbws = is_array( $dbws ) ? $dbws : [ $dbws ];
+               foreach ( $dbws as $dbw ) {
+                       if ( $dbw && $dbw->trxLevel() ) {
+                               $dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ], $fname );
+                       }
                }
        }