Merge "Create a custom log formatter that allows log entries to contain wikitext"
[lhc/web/wiklou.git] / includes / deferred / AtomicSectionUpdate.php
index ccbd6b0..8b62989 100644 (file)
@@ -1,15 +1,17 @@
 <?php
 
+use Wikimedia\Rdbms\IDatabase;
+
 /**
  * Deferrable Update for closure/callback updates via IDatabase::doAtomicSection()
  * @since 1.27
  */
-class AtomicSectionUpdate implements DeferrableUpdate {
+class AtomicSectionUpdate implements DeferrableUpdate, DeferrableCallback {
        /** @var IDatabase */
        private $dbw;
        /** @var string */
        private $fname;
-       /** @var callable */
+       /** @var callable|null */
        private $callback;
 
        /**
@@ -24,7 +26,7 @@ class AtomicSectionUpdate implements DeferrableUpdate {
                $this->callback = $callback;
 
                if ( $this->dbw->trxLevel() ) {
-                       $this->dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ] );
+                       $this->dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ], $fname );
                }
        }
 
@@ -39,4 +41,8 @@ class AtomicSectionUpdate implements DeferrableUpdate {
                        $this->callback = null;
                }
        }
+
+       public function getOrigin() {
+               return $this->fname;
+       }
 }