dbw = $dbw; $this->fname = $fname; $this->callback = $callback; if ( $this->dbw->trxLevel() ) { $this->dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ], $fname ); } } public function doUpdate() { if ( !$this->callback ) { return; } $autoTrx = $this->dbw->getFlag( DBO_TRX ); $this->dbw->clearFlag( DBO_TRX ); try { /** @var Exception $e */ $e = null; call_user_func_array( $this->callback, [ $this->dbw, $this->fname ] ); } catch ( Exception $e ) { } if ( $autoTrx ) { $this->dbw->setFlag( DBO_TRX ); } if ( $e ) { throw $e; } } public function cancelOnRollback( $trigger ) { if ( $trigger === IDatabase::TRIGGER_ROLLBACK ) { $this->callback = null; } } public function getOrigin() { return $this->fname; } }