| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Watchlist; |
| 4 |
|
| 5 |
use Job; |
| 6 |
use MediaWiki\MediaWikiServices; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class WatchlistExpiryJob extends Job { |
| 13 |
|
| 14 |
public function __construct( string $command = 'watchlistExpiry', array $params = [] ) { |
| 15 |
parent::__construct( $command, $params ); |
| 16 |
} |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
public function run() { |
| 24 |
$services = MediaWikiServices::getInstance(); |
| 25 |
$watchedItemStore = $services->getWatchedItemStore(); |
| 26 |
$watchedItemStore->removeExpired( 100 ); |
| 27 |
if ( $watchedItemStore->countExpired() ) { |
| 28 |
|
| 29 |
$services->getJobQueueGroup()->push( new static() ); |
| 30 |
} |
| 31 |
return true; |
| 32 |
} |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
class_alias( WatchlistExpiryJob::class, 'WatchlistExpiryJob' ); |