1<?php 2 3/** 4 * Deferrable update that must run outside of any explicit LBFactory transaction round 5 * 6 * @since 1.31 7 */ 8class TransactionRoundDefiningUpdate 9 implements DeferrableUpdate, DeferrableCallback, TransactionRoundAwareUpdate 10{ 11 /** @var callable|null */ 12 private $callback; 13 /** @var string */ 14 private $fname; 15 16 /** 17 * @param callable $callback 18 * @param string $fname Calling method 19 */ 20 public function __construct( callable $callback, $fname = 'unknown' ) { 21 $this->callback = $callback; 22 $this->fname = $fname; 23 } 24 25 public function doUpdate() { 26 call_user_func( $this->callback ); 27 } 28 29 public function getOrigin() { 30 return $this->fname; 31 } 32 33 /** 34 * @return int One of the class TRX_ROUND_* constants 35 * @since 1.34 36 */ 37 final public function getTransactionRoundRequirement() { 38 return self::TRX_ROUND_ABSENT; 39 } 40} 41