3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
21 use MediaWiki\Config\ServiceOptions
;
22 use MediaWiki\Logger\LoggerFactory
;
23 use MediaWiki\MediaWikiServices
;
24 use MediaWiki\Storage\EditResult
;
25 use MediaWiki\Storage\RevertedTagUpdate
;
28 * Job for deferring the execution of RevertedTagUpdate.
30 * @internal For use by \MediaWiki\Storage\RevertedTagUpdate
35 class RevertedTagUpdateJob
extends Job
implements GenericParameterJob
{
38 * Returns a JobSpecification for this job.
40 * @param int $revertRevisionId
41 * @param EditResult $editResult
43 * @return JobSpecification
45 public static function newSpec(
46 int $revertRevisionId,
47 EditResult
$editResult
49 return new JobSpecification(
52 'revertId' => $revertRevisionId,
53 'editResult' => $editResult->jsonSerialize()
59 * @param array $params
60 * @phan-param array{revertId:int,editResult:array} $params
62 public function __construct( array $params ) {
63 parent
::__construct( 'revertedTagUpdate', $params );
67 * Unpacks the job arguments and runs the update.
71 public function run() {
72 $services = MediaWikiServices
::getInstance();
73 $editResult = EditResult
::newFromArray(
74 $this->params
['editResult']
77 $update = new RevertedTagUpdate(
78 $services->getRevisionStore(),
79 LoggerFactory
::getInstance( 'RevertedTagUpdate' ),
80 $services->getChangeTagsStore(),
81 $services->getConnectionProvider(),
83 RevertedTagUpdate
::CONSTRUCTOR_OPTIONS
,
84 $services->getMainConfig()
86 $this->params
['revertId'],