MediaWiki
master
WatchlistExpiryJob.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Watchlist
;
4
5
use
Job
;
6
use
MediaWiki\MediaWikiServices
;
7
12
class
WatchlistExpiryJob
extends
Job
{
13
14
public
function
__construct
(
string
$command
=
'watchlistExpiry'
, array
$params
= [] ) {
15
parent::__construct(
$command
,
$params
);
16
}
17
23
public
function
run
() {
24
$services =
MediaWikiServices::getInstance
();
25
$watchedItemStore = $services->getWatchedItemStore();
26
$watchedItemStore->removeExpired( 100 );
27
if
( $watchedItemStore->countExpired() ) {
28
// If there are still items, add a new job.
29
$services->getJobQueueGroup()->push(
new
static
() );
30
}
31
return
true
;
32
}
33
34
}
36
class_alias( WatchlistExpiryJob::class,
'WatchlistExpiryJob'
);
Job
Describe and execute a background job.
Definition
Job.php:41
Job\$command
string $command
Definition
Job.php:43
Job\$params
array $params
Array of job parameters.
Definition
Job.php:46
MediaWiki\MediaWikiServices
Service locator for MediaWiki core services.
Definition
MediaWikiServices.php:240
MediaWiki\MediaWikiServices\getInstance
static getInstance()
Returns the global default instance of the top level service locator.
Definition
MediaWikiServices.php:323
MediaWiki\Watchlist\WatchlistExpiryJob
Definition
WatchlistExpiryJob.php:12
MediaWiki\Watchlist\WatchlistExpiryJob\__construct
__construct(string $command='watchlistExpiry', array $params=[])
Definition
WatchlistExpiryJob.php:14
MediaWiki\Watchlist\WatchlistExpiryJob\run
run()
Run the job recursively in batches of 100 until there are no more expired items.
Definition
WatchlistExpiryJob.php:23
MediaWiki\Watchlist
Definition
ActivityUpdateJob.php:21
includes
watchlist
WatchlistExpiryJob.php
Generated on Mon Oct 7 2024 08:26:06 for MediaWiki by
1.10.0