Providing the function name is often optional from the php code, but it is needed for better logging, so make it mandatory and let phan report issues about this. Bug: T374546 Follow-Up: I5227f2fa65850ac8c6f620900f22d1f4e7bfd470 Change-Id: I3becd23d3ba9f452a8afd833d509cd907e56ca47
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?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' );
|