MediaWiki REL1_35
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 $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
18 $watchedItemStore->removeExpired( 100 );
19 if ( $watchedItemStore->countExpired() ) {
20 // If there are still items, add a new job.
21 JobQueueGroup::singleton()->push( new static() );
22 }
23 return true;
24 }
25
26}
Class to both describe a background job and handle jobs.
Definition Job.php:32
string $command
Definition Job.php:34
array $params
Array of job parameters.
Definition Job.php:37
MediaWikiServices is the service locator for the application scope of MediaWiki.
__construct(string $command='watchlistExpiry', array $params=[])
run()
Run the job recursively in batches of 100 until there are no more expired items.