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