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