Merge "Fix SQLite $wgObjectCaches definition + b/c handling"
[lhc/web/wiklou.git] / includes / deferred / AutoCommitUpdate.php
index ddf2bb8..d61dec2 100644 (file)
@@ -4,12 +4,12 @@
  * Deferrable Update for closure/callback updates that should use auto-commit mode
  * @since 1.28
  */
-class AutoCommitUpdate implements DeferrableUpdate {
+class AutoCommitUpdate implements DeferrableUpdate, DeferrableCallback {
        /** @var IDatabase */
        private $dbw;
        /** @var string */
        private $fname;
-       /** @var callable */
+       /** @var callable|null */
        private $callback;
 
        /**
@@ -23,7 +23,7 @@ class AutoCommitUpdate implements DeferrableUpdate {
                $this->callback = $callback;
 
                if ( $this->dbw->trxLevel() ) {
-                       $this->dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ] );
+                       $this->dbw->onTransactionResolution( [ $this, 'cancelOnRollback' ], $fname );
                }
        }
 
@@ -53,4 +53,8 @@ class AutoCommitUpdate implements DeferrableUpdate {
                        $this->callback = null;
                }
        }
+
+       public function getOrigin() {
+               return $this->fname;
+       }
 }