X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fdeferred%2FAtomicSectionUpdate.php;h=69f09e392868f7726ae260c8c1fa018748c24867;hb=f9242d74f8fdde9a3be6994274f6be23f768ffba;hp=6585575dc352f307a741ef02a5af56a34e8fa9ab;hpb=72b9240497311a2fa5f5b76d9e8bb953dc59853f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/AtomicSectionUpdate.php b/includes/deferred/AtomicSectionUpdate.php index 6585575dc3..69f09e3928 100644 --- a/includes/deferred/AtomicSectionUpdate.php +++ b/includes/deferred/AtomicSectionUpdate.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 ); + } } } @@ -34,6 +40,10 @@ class AtomicSectionUpdate 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;