38 parent::__construct(
'clearWatchlistNotifications', $title,
$params );
40 static $required = [
'userId',
'casTime' ];
42 if ( $missing !=
'' ) {
43 throw new InvalidArgumentException(
"Missing parameter(s) $missing" );
46 $this->removeDuplicates =
true;
49 public function run() {
50 $services = MediaWikiServices::getInstance();
51 $lbFactory =
$services->getDBLoadBalancerFactory();
52 $rowsPerQuery =
$services->getMainConfig()->get(
'UpdateRowsPerQuery' );
54 $dbw = $lbFactory->getMainLB()->getConnection(
DB_MASTER );
55 $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
56 $timestamp = $this->params[
'timestamp'] ??
null;
57 if ( $timestamp ===
null ) {
58 $timestampCond =
'wl_notificationtimestamp IS NOT NULL';
60 $timestamp = $dbw->timestamp( $timestamp );
61 $timestampCond =
'wl_notificationtimestamp != ' . $dbw->addQuotes( $timestamp ) .
62 ' OR wl_notificationtimestamp IS NULL';
65 $casTimeCond =
'wl_notificationtimestamp < ' .
66 $dbw->addQuotes( $dbw->timestamp( $this->params[
'casTime'] ) ) .
67 ' OR wl_notificationtimestamp IS NULL';
71 $idsToUpdate = $dbw->selectFieldValues(
75 'wl_user' => $this->params[
'userId'],
80 [
'LIMIT' => $rowsPerQuery ]
85 [
'wl_notificationtimestamp' => $timestamp ],
87 'wl_id' => $idsToUpdate,
94 $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
98 }
while ( $idsToUpdate );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Job for clearing all of the "last viewed" timestamps for a user's watchlist, or setting them all to t...
__construct(Title $title, array $params)
Class to both describe a background job and handle jobs.
array $params
Array of job parameters.
Represents a title within MediaWiki.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))