/** * Reset the notification timestamp of this entry * * @param User $user * @param Title $title * @param string $force Whether to force the write query to be executed even if the * page is not watched or the notification timestamp is already NULL. * 'force' in order to force * @param int $oldid The revision id being viewed. If not given or 0, latest revision is assumed. * * @return bool success */ public function resetNotificationTimestamp(User $user, Title $title, $force = '', $oldid = 0) { // Only loggedin user can have a watchlist if ($this->loadBalancer->getReadOnlyReason() !== false || $user->isAnon()) { return false; } $item = null; if ($force != 'force') { $item = $this->loadWatchedItem($user, $title); if (!$item || $item->getNotificationTimestamp() === null) { return false; } } // If the page is watched by the user (or may be watched), update the timestamp $job = new ActivityUpdateJob($title, ['type' => 'updateWatchlistNotification', 'userid' => $user->getId(), 'notifTime' => $this->getNotificationTimestamp($user, $title, $item, $force, $oldid), 'curTime' => time()]); // Try to run this post-send // Calls DeferredUpdates::addCallableUpdate in normal operation call_user_func($this->deferredUpdatesAddCallableUpdateCallback, function () use($job) { $job->run(); }); $this->uncache($user, $title); return true; }