Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / jobqueue / jobs / RevertedTagUpdateJob.php
blob7c220a7302f5a3d4e69b69972eeac532c7e3f885
1 <?php
2 /**
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
18 * @file
21 use MediaWiki\Config\ServiceOptions;
22 use MediaWiki\Logger\LoggerFactory;
23 use MediaWiki\MediaWikiServices;
24 use MediaWiki\Storage\EditResult;
25 use MediaWiki\Storage\RevertedTagUpdate;
27 /**
28 * Job for deferring the execution of RevertedTagUpdate.
30 * @internal For use by \MediaWiki\Storage\RevertedTagUpdate
31 * @since 1.36
32 * @ingroup JobQueue
33 * @author Ostrzyciel
35 class RevertedTagUpdateJob extends Job implements GenericParameterJob {
37 /**
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
48 ): JobSpecification {
49 return new JobSpecification(
50 'revertedTagUpdate',
52 'revertId' => $revertRevisionId,
53 'editResult' => $editResult->jsonSerialize()
58 /**
59 * @param array $params
60 * @phan-param array{revertId:int,editResult:array} $params
62 public function __construct( array $params ) {
63 parent::__construct( 'revertedTagUpdate', $params );
66 /**
67 * Unpacks the job arguments and runs the update.
69 * @return bool
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(),
82 new ServiceOptions(
83 RevertedTagUpdate::CONSTRUCTOR_OPTIONS,
84 $services->getMainConfig()
86 $this->params['revertId'],
87 $editResult
90 $update->doUpdate();
91 return true;