2017-10-12 20:19:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
2018-04-16 20:38:01 +00:00
|
|
|
* Deferrable update that must run outside of any explicit LBFactory transaction round
|
2017-10-12 20:19:56 +00:00
|
|
|
*
|
|
|
|
|
* @since 1.31
|
|
|
|
|
*/
|
2019-05-21 21:52:57 +00:00
|
|
|
class TransactionRoundDefiningUpdate
|
|
|
|
|
implements DeferrableUpdate, DeferrableCallback, TransactionRoundAwareUpdate
|
|
|
|
|
{
|
2017-10-12 20:19:56 +00:00
|
|
|
/** @var callable|null */
|
|
|
|
|
private $callback;
|
|
|
|
|
/** @var string */
|
|
|
|
|
private $fname;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param callable $callback
|
|
|
|
|
* @param string $fname Calling method
|
|
|
|
|
*/
|
|
|
|
|
public function __construct( callable $callback, $fname = 'unknown' ) {
|
|
|
|
|
$this->callback = $callback;
|
|
|
|
|
$this->fname = $fname;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function doUpdate() {
|
|
|
|
|
call_user_func( $this->callback );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getOrigin() {
|
|
|
|
|
return $this->fname;
|
|
|
|
|
}
|
2019-05-21 21:52:57 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return int One of the class TRX_ROUND_* constants
|
|
|
|
|
* @since 1.34
|
|
|
|
|
*/
|
|
|
|
|
final public function getTransactionRoundRequirement() {
|
|
|
|
|
return self::TRX_ROUND_ABSENT;
|
|
|
|
|
}
|
2017-10-12 20:19:56 +00:00
|
|
|
}
|