MediaWiki master
WatchlistExpiryJob.php
Go to the documentation of this file.
1<?php
2
4
9class WatchlistExpiryJob extends Job {
10
11 public function __construct( string $command = 'watchlistExpiry', array $params = [] ) {
12 parent::__construct( $command, $params );
13 }
14
20 public function run() {
21 $services = MediaWikiServices::getInstance();
22 $watchedItemStore = $services->getWatchedItemStore();
23 $watchedItemStore->removeExpired( 100 );
24 if ( $watchedItemStore->countExpired() ) {
25 // If there are still items, add a new job.
26 $services->getJobQueueGroup()->push( new static() );
27 }
28 return true;
29 }
30
31}
array $params
The job parameters.
Describe and execute a background job.
Definition Job.php:40
string $command
Definition Job.php:42
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.