MediaWiki REL1_39
WatchlistExpiryJob.php
Go to the documentation of this file.
1<?php
2
4
5class WatchlistExpiryJob extends Job {
6
7 public function __construct( string $command = 'watchlistExpiry', array $params = [] ) {
8 parent::__construct( $command, $params );
9 }
10
16 public function run() {
17 $services = MediaWikiServices::getInstance();
18 $watchedItemStore = $services->getWatchedItemStore();
19 $watchedItemStore->removeExpired( 100 );
20 if ( $watchedItemStore->countExpired() ) {
21 // If there are still items, add a new job.
22 $services->getJobQueueGroup()->push( new static() );
23 }
24 return true;
25 }
26
27}
Class to both describe a background job and handle jobs.
Definition Job.php:39
array $params
Array of job parameters.
Definition Job.php:44
Service locator for MediaWiki core services.
__construct(string $command='watchlistExpiry', array $params=[])
run()
Run the job recursively in batches of 100 until there are no more expired items.
$command
Definition mcc.php:125