Merge "API: Add generator non-continuation data"
[lhc/web/wiklou.git] / includes / deferred / AtomicSectionUpdate.php
index ccbd6b0..6585575 100644 (file)
@@ -4,12 +4,12 @@
  * 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 +24,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 +39,8 @@ class AtomicSectionUpdate implements DeferrableUpdate {
                        $this->callback = null;
                }
        }
+
+       public function getOrigin() {
+               return $this->fname;
+       }
 }