X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdeferred%2FAutoCommitUpdate.php;h=ddfd98716d8da8814f046813b541ed88a4d07e5e;hb=17080453a1a94d317247197b639472f87e2aaa03;hp=d61dec2cb28257a674fecf29b5fddd4bea27f6ee;hpb=320e4c56132681f811c2819e3e22e98715f46ae7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/AutoCommitUpdate.php b/includes/deferred/AutoCommitUpdate.php index d61dec2cb2..ddfd98716d 100644 --- a/includes/deferred/AutoCommitUpdate.php +++ b/includes/deferred/AutoCommitUpdate.php @@ -1,5 +1,7 @@ dbw = $dbw; $this->fname = $fname; $this->callback = $callback; - - if ( $this->dbw->trxLevel() ) { - $this->dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ], $fname ); + // Register DB connections for which uncommitted changes are related to this update + $conns[] = $dbw; + foreach ( $conns as $conn ) { + if ( $conn->trxLevel() ) { + $conn->onTransactionResolution( [ $this, 'cancelOnRollback' ], $fname ); + } } } @@ -37,7 +43,7 @@ class AutoCommitUpdate implements DeferrableUpdate, DeferrableCallback { try { /** @var Exception $e */ $e = null; - call_user_func_array( $this->callback, [ $this->dbw, $this->fname ] ); + ( $this->callback )( $this->dbw, $this->fname ); } catch ( Exception $e ) { } if ( $autoTrx ) { @@ -48,6 +54,10 @@ class AutoCommitUpdate implements DeferrableUpdate, DeferrableCallback { } } + /** + * @private This method is public so that it works with onTransactionResolution() + * @param int $trigger + */ public function cancelOnRollback( $trigger ) { if ( $trigger === IDatabase::TRIGGER_ROLLBACK ) { $this->callback = null;