MediaWiki REL1_37
DeletePageJob.php
Go to the documentation of this file.
1<?php
2
4
8class DeletePageJob extends Job implements GenericParameterJob {
9 public function __construct( array $params ) {
10 parent::__construct( 'deletePage', $params );
11
12 $this->title = Title::makeTitle( $params['namespace'], $params['title'] );
13 }
14
15 public function run() {
16 // Failure to load the page is not job failure.
17 // A parallel deletion operation may have already completed the page deletion.
18 $wikiPage = MediaWikiServices::getInstance()->getWikiPageFactory()->newFromID( $this->params['wikiPageId'] );
19 if ( $wikiPage ) {
20 $wikiPage->doDeleteArticleBatched(
21 $this->params['reason'],
22 $this->params['suppress'],
23 User::newFromId( $this->params['userId'] ),
24 json_decode( $this->params['tags'] ),
25 $this->params['logsubtype'],
26 false,
27 $this->getRequestId() );
28 }
29 return true;
30 }
31}
Class DeletePageJob.
__construct(array $params)
run()
Run the job.
Class to both describe a background job and handle jobs.
Definition Job.php:37
getRequestId()
string|null Id of the request that created this job. Follows jobs recursively, allowing to track the ...
Definition Job.php:251
MediaWikiServices is the service locator for the application scope of MediaWiki.
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition User.php:648
Interface for generic jobs only uses the parameters field and are JSON serializable.