From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- includes/jobqueue/jobs/ActivityUpdateJob.php | 75 ++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 includes/jobqueue/jobs/ActivityUpdateJob.php (limited to 'includes/jobqueue/jobs/ActivityUpdateJob.php') diff --git a/includes/jobqueue/jobs/ActivityUpdateJob.php b/includes/jobqueue/jobs/ActivityUpdateJob.php new file mode 100644 index 00000000..f146e6e8 --- /dev/null +++ b/includes/jobqueue/jobs/ActivityUpdateJob.php @@ -0,0 +1,75 @@ +removeDuplicates = true; + } + + public function run() { + if ( $this->params['type'] === 'updateWatchlistNotification' ) { + $this->updateWatchlistNotification(); + } else { + throw new Exception( "Invalid 'type' parameter '{$this->params['type']}'." ); + } + + return true; + } + + protected function updateWatchlistNotification() { + $casTimestamp = ( $this->params['notifTime'] !== null ) + ? $this->params['notifTime'] + : $this->params['curTime']; + + $dbw = wfGetDB( DB_MASTER ); + $dbw->update( 'watchlist', + array( + 'wl_notificationtimestamp' => $dbw->timestampOrNull( $this->params['notifTime'] ) + ), + array( + 'wl_user' => $this->params['userid'], + 'wl_namespace' => $this->title->getNamespace(), + 'wl_title' => $this->title->getDBkey(), + // Add a "check and set" style comparison to handle conflicts. + // The inequality always avoids updates when the current value + // is already NULL per ANSI SQL. This is desired since NULL means + // that the user is "caught up" on edits already. When the field + // is non-NULL, make sure not to set it back in time or set it to + // NULL when newer revisions were in fact added to the page. + 'wl_notificationtimestamp < ' . $dbw->addQuotes( $dbw->timestamp( $casTimestamp ) ) + ), + __METHOD__ + ); + } +} -- cgit v1.2.2