X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdeferred%2FMWCallableUpdate.php;h=707035c3f80c18b6adad6bb8aba86e1b858815d1;hb=04cea76cbbd1c66ddfa2a674cf383ffb497234ae;hp=9803b7a491b10312e5268aedb58b14038974d583;hpb=2886f0d5d60e10d62359e9f97ea5095719fe9011;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/MWCallableUpdate.php b/includes/deferred/MWCallableUpdate.php index 9803b7a491..707035c3f8 100644 --- a/includes/deferred/MWCallableUpdate.php +++ b/includes/deferred/MWCallableUpdate.php @@ -5,11 +5,15 @@ use Wikimedia\Rdbms\IDatabase; /** * Deferrable Update for closure/callback */ -class MWCallableUpdate implements DeferrableUpdate, DeferrableCallback { - /** @var callable|null */ +class MWCallableUpdate + implements DeferrableUpdate, DeferrableCallback, TransactionRoundAwareUpdate +{ + /** @var callable|null Callback, or null if it was cancelled */ private $callback; - /** @var string */ + /** @var string Calling method name */ private $fname; + /** @var int One of the class TRX_ROUND_* constants */ + private $trxRoundRequirement = self::TRX_ROUND_PRESENT; /** * @param callable $callback @@ -35,6 +39,10 @@ class MWCallableUpdate 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; @@ -44,4 +52,16 @@ class MWCallableUpdate implements DeferrableUpdate, DeferrableCallback { public function getOrigin() { return $this->fname; } + + /** + * @since 1.34 + * @param int $mode One of the class TRX_ROUND_* constants + */ + public function setTransactionRoundRequirement( $mode ) { + $this->trxRoundRequirement = $mode; + } + + public function getTransactionRoundRequirement() { + return $this->trxRoundRequirement; + } }