X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2Fdeferred%2FMWCallableUpdate.php;h=9803b7a491b10312e5268aedb58b14038974d583;hb=a7e2b91b2c72f3522a7a9c3c957a43309e70b92e;hp=5b822af492b49ea0f00bd7004d7b89547de89991;hpb=d5a7166771613dfe4ed9fb75fa5efeced6134bd1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/MWCallableUpdate.php b/includes/deferred/MWCallableUpdate.php index 5b822af492..9803b7a491 100644 --- a/includes/deferred/MWCallableUpdate.php +++ b/includes/deferred/MWCallableUpdate.php @@ -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 ); + } } }