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