MediaWiki  master
RevertedTagUpdateJob.php
Go to the documentation of this file.
1 <?php
29 
38 class RevertedTagUpdateJob extends Job implements GenericParameterJob {
39 
48  public static function newSpec(
49  int $revertRevisionId,
50  EditResult $editResult
51  ) : JobSpecification {
52  return new JobSpecification(
53  'revertedTagUpdate',
54  [
55  'revertId' => $revertRevisionId,
56  'editResult' => $editResult->jsonSerialize()
57  ]
58  );
59  }
60 
65  public function __construct( array $params ) {
66  parent::__construct( 'revertedTagUpdate', $params );
67  }
68 
74  public function run() {
75  $services = MediaWikiServices::getInstance();
76  $editResult = EditResult::newFromArray(
77  $this->params['editResult']
78  );
79 
80  $update = new RevertedTagUpdate(
81  $services->getRevisionStore(),
82  LoggerFactory::getInstance( 'RevertedTagUpdate' ),
84  $services->getDBLoadBalancer(),
85  new ServiceOptions(
86  RevertedTagUpdate::CONSTRUCTOR_OPTIONS,
87  $services->getMainConfig()
88  ),
89  $this->params['revertId'],
90  $editResult
91  );
92 
93  $update->doUpdate();
94  return true;
95  }
96 }
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:163
MediaWiki\Storage\EditResult\jsonSerialize
jsonSerialize()
Returns an array representing the EditResult object.
Definition: EditResult.php:280
RevertedTagUpdateJob\newSpec
static newSpec(int $revertRevisionId, EditResult $editResult)
Returns a JobSpecification for this job.
Definition: RevertedTagUpdateJob.php:48
Job\$params
array $params
Array of job parameters.
Definition: Job.php:37
MediaWiki\Storage\RevertedTagUpdate
Adds the mw-reverted tag to reverted edits after a revert is made.
Definition: RevertedTagUpdate.php:41
Job
Class to both describe a background job and handle jobs.
Definition: Job.php:32
MediaWiki\Config\ServiceOptions
A class for passing options to services.
Definition: ServiceOptions.php:27
MediaWiki\Logger\LoggerFactory
PSR-3 logger instance factory.
Definition: LoggerFactory.php:45
ChangeTags\getSoftwareTags
static getSoftwareTags( $all=false)
Loads defined core tags, checks for invalid types (if not array), and filters for supported and enabl...
Definition: ChangeTags.php:78
MediaWiki\Storage\EditResult
Object for storing information about the effects of an edit.
Definition: EditResult.php:38
RevertedTagUpdateJob\run
run()
Unpacks the job arguments and runs the update.
Definition: RevertedTagUpdateJob.php:74
JobSpecification
Job queue task description base code.
Definition: JobSpecification.php:39
GenericParameterJob
Interface for generic jobs only uses the parameters field and are JSON serializable.
Definition: GenericParameterJob.php:31
RevertedTagUpdateJob\__construct
__construct(array $params)
Definition: RevertedTagUpdateJob.php:65
RevertedTagUpdateJob
Job for deferring the execution of RevertedTagUpdate.
Definition: RevertedTagUpdateJob.php:38