3 use MediaWiki\MediaWikiServices
;
4 use MediaWiki\Page\DeletePage
;
5 use MediaWiki\Title\Title
;
12 class DeletePageJob
extends Job
implements GenericParameterJob
{
13 public function __construct( array $params ) {
14 parent
::__construct( 'deletePage', $params );
16 $this->title
= Title
::makeTitle( $params['namespace'], $params['title'] );
19 public function run() {
20 $services = MediaWikiServices
::getInstance();
21 $ticket = $services->getDBLoadBalancerFactory()->getEmptyTransactionTicket( __METHOD__
);
22 // Failure to load the page is not job failure.
23 // A parallel deletion operation may have already completed the page deletion.
24 $wikiPage = $services->getWikiPageFactory()->newFromID( $this->params
['wikiPageId'] );
26 $deletePage = $services->getDeletePageFactory()->newDeletePage(
28 $services->getUserFactory()->newFromId( $this->params
['userId'] )
31 ->setSuppress( $this->params
['suppress'] )
32 ->setTags( json_decode( $this->params
['tags'] ) )
33 ->setLogSubtype( $this->params
['logsubtype'] )
34 ->setDeletionAttempted()
37 // Use a fallback for BC with queued jobs.
38 $this->params
['pageRole'] ?? DeletePage
::PAGE_BASE
,
39 $this->params
['reason'],
40 $this->getRequestId(),