| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
use MediaWiki\Config\ServiceOptions; |
| 22 |
use MediaWiki\Logger\LoggerFactory; |
| 23 |
use MediaWiki\MediaWikiServices; |
| 24 |
use MediaWiki\Storage\EditResult; |
| 25 |
use MediaWiki\Storage\RevertedTagUpdate; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
class RevertedTagUpdateJob extends Job implements GenericParameterJob { |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
public static function newSpec( |
| 46 |
int $revertRevisionId, |
| 47 |
EditResult $editResult |
| 48 |
): JobSpecification { |
| 49 |
return new JobSpecification( |
| 50 |
'revertedTagUpdate', |
| 51 |
[ |
| 52 |
'revertId' => $revertRevisionId, |
| 53 |
'editResult' => $editResult->jsonSerialize() |
| 54 |
] |
| 55 |
); |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
public function __construct( array $params ) { |
| 63 |
parent::__construct( 'revertedTagUpdate', $params ); |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
public function run() { |
| 72 |
$services = MediaWikiServices::getInstance(); |
| 73 |
$editResult = EditResult::newFromArray( |
| 74 |
$this->params['editResult'] |
| 75 |
); |
| 76 |
|
| 77 |
$update = new RevertedTagUpdate( |
| 78 |
$services->getRevisionStore(), |
| 79 |
LoggerFactory::getInstance( 'RevertedTagUpdate' ), |
| 80 |
$services->getChangeTagsStore(), |
| 81 |
$services->getConnectionProvider(), |
| 82 |
new ServiceOptions( |
| 83 |
RevertedTagUpdate::CONSTRUCTOR_OPTIONS, |
| 84 |
$services->getMainConfig() |
| 85 |
), |
| 86 |
$this->params['revertId'], |
| 87 |
$editResult |
| 88 |
); |
| 89 |
|
| 90 |
$update->doUpdate(); |
| 91 |
return true; |
| 92 |
} |
| 93 |
} |