Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| DataUpdate | |
0.00% |
0 / 6 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setTransactionTicket | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setCause | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getCauseAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getCauseAgent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Base code for update jobs that do something with some secondary |
| 4 | * data extracted from article. |
| 5 | * |
| 6 | * @license GPL-2.0-or-later |
| 7 | * @file |
| 8 | */ |
| 9 | |
| 10 | namespace MediaWiki\Deferred; |
| 11 | |
| 12 | /** |
| 13 | * Abstract base class for update jobs that do something with some secondary |
| 14 | * data extracted from article. |
| 15 | * |
| 16 | * @stable to extend |
| 17 | */ |
| 18 | abstract class DataUpdate implements DeferrableUpdate { |
| 19 | /** @var mixed Result from LBFactory::getEmptyTransactionTicket() */ |
| 20 | protected $ticket; |
| 21 | /** @var string Short update cause action description */ |
| 22 | protected $causeAction = 'unknown'; |
| 23 | /** @var string Short update cause user description */ |
| 24 | protected $causeAgent = 'unknown'; |
| 25 | |
| 26 | /** |
| 27 | * @stable to call |
| 28 | */ |
| 29 | public function __construct() { |
| 30 | // noop |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * @param mixed $ticket Result of getEmptyTransactionTicket() |
| 35 | * @since 1.28 |
| 36 | */ |
| 37 | public function setTransactionTicket( $ticket ) { |
| 38 | $this->ticket = $ticket; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @param string $action Action type |
| 43 | * @param string $user User name |
| 44 | */ |
| 45 | public function setCause( $action, $user ) { |
| 46 | $this->causeAction = $action; |
| 47 | $this->causeAgent = $user; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @return string |
| 52 | */ |
| 53 | public function getCauseAction() { |
| 54 | return $this->causeAction; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @return string |
| 59 | */ |
| 60 | public function getCauseAgent() { |
| 61 | return $this->causeAgent; |
| 62 | } |
| 63 | |
| 64 | } |
| 65 | |
| 66 | /** @deprecated class alias since 1.42 */ |
| 67 | class_alias( DataUpdate::class, 'DataUpdate' ); |