MediaWiki master
WatchedItemStoreInterface.php
Go to the documentation of this file.
1<?php
8namespace MediaWiki\Watchlist;
9
12
18
22 public const SORT_ASC = 'ASC';
23
27 public const SORT_DESC = 'DESC';
28
39 public function countWatchedItems( UserIdentity $user );
40
48 public function countWatchers( PageReference $target );
49
60 public function countVisitingWatchers( PageReference $target, $threshold );
61
73 public function countWatchersMultiple( array $targets, array $options = [] );
74
96 array $targetsWithVisitThresholds,
97 $minimumWatchers = null
98 );
99
110 public function getWatchedItem( UserIdentity $user, PageReference $target );
111
122 public function loadWatchedItem( UserIdentity $user, PageReference $target );
123
134 public function loadWatchedItemsBatch( UserIdentity $user, array $targets );
135
149 public function getWatchedItemsForUser( UserIdentity $user, array $options = [] );
150
161 public function isWatched( UserIdentity $user, PageReference $target );
162
174 public function isTempWatched( UserIdentity $user, PageReference $target ): bool;
175
187 public function getNotificationTimestampsBatch( UserIdentity $user, array $targets );
188
200 public function addWatch( UserIdentity $user, PageReference $target, ?string $expiry = null );
201
213 public function addWatchBatchForUser( UserIdentity $user, array $targets, ?string $expiry = null );
214
226 public function removeWatch( UserIdentity $user, PageReference $target );
227
238 UserIdentity $user,
239 $timestamp,
240 array $targets = []
241 );
242
251 public function resetAllNotificationTimestampsForUser( UserIdentity $user, $timestamp = null );
252
264 UserIdentity $editor, PageReference $target, $timestamp );
265
282 UserIdentity $user, PageReference $title, $force = '', $oldid = 0 );
283
293 public function countUnreadNotifications( UserIdentity $user, $unreadLimit = null );
294
306 public function duplicateAllAssociatedEntries( PageReference $oldTarget, PageReference $newTarget );
307
320 public function duplicateEntry( PageReference $oldTarget, PageReference $newTarget );
321
331 public function clearUserWatchedItems( UserIdentity $user );
332
342 public function mustClearWatchedItemsUsingJobQueue( UserIdentity $user ): bool;
343
352
359 public function maybeEnqueueWatchlistExpiryJob(): void;
360
369 public function removeWatchBatchForUser( UserIdentity $user, array $targets );
370
385 $timestamp, UserIdentity $user, PageReference $target );
386
394 public function countExpired(): int;
395
406 public function removeExpired( int $limit, bool $deleteOrphans = false ): void;
407
417 public function addLabels( UserIdentity $user, array $targets, array $labels ): void;
418
428 public function removeLabels( UserIdentity $user, array $targets, array $labels ): void;
429}
431class_alias( WatchedItemStoreInterface::class, 'WatchedItemStoreInterface' );
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
Interface for objects representing user identity.
duplicateAllAssociatedEntries(PageReference $oldTarget, PageReference $newTarget)
Check if the given title already is watched by the user, and if so add a watch for the new title.
addLabels(UserIdentity $user, array $targets, array $labels)
Add a labels to a set of watchlist items.
getWatchedItemsForUser(UserIdentity $user, array $options=[])
addWatch(UserIdentity $user, PageReference $target, ?string $expiry=null)
Must be called separately for Subject & Talk namespaces.
duplicateEntry(PageReference $oldTarget, PageReference $newTarget)
Check if the given title already is watched by the user, and if so add a watch for the new title.
removeWatchBatchForUser(UserIdentity $user, array $targets)
getLatestNotificationTimestamp( $timestamp, UserIdentity $user, PageReference $target)
Convert $timestamp to TS_MW or return null if the page was visited since then by $user.
countWatchersMultiple(array $targets, array $options=[])
countVisitingWatchers(PageReference $target, $threshold)
Number of page watchers who also visited a "recent" edit.
getNotificationTimestampsBatch(UserIdentity $user, array $targets)
addWatchBatchForUser(UserIdentity $user, array $targets, ?string $expiry=null)
countExpired()
Get the number of watchlist items that expire before the current time.
countWatchedItems(UserIdentity $user)
Count the number of individual items that are watched by the user.
setNotificationTimestampsForUser(UserIdentity $user, $timestamp, array $targets=[])
resetAllNotificationTimestampsForUser(UserIdentity $user, $timestamp=null)
Reset all watchlist notification timestamps for a user using the job queue.
mustClearWatchedItemsUsingJobQueue(UserIdentity $user)
Does the size of the users watchlist require clearUserWatchedItemsUsingJobQueue() to be used instead ...
countVisitingWatchersMultiple(array $targetsWithVisitThresholds, $minimumWatchers=null)
Number of watchers of each page who have visited recent edits to that page.
clearUserWatchedItems(UserIdentity $user)
Synchronously clear the users watchlist.
removeWatch(UserIdentity $user, PageReference $target)
Removes an entry for the UserIdentity watching the target Must be called separately for Subject & Tal...
loadWatchedItem(UserIdentity $user, PageReference $target)
Loads an item from the db.
loadWatchedItemsBatch(UserIdentity $user, array $targets)
Loads a set of WatchedItems from the db.
resetNotificationTimestamp(UserIdentity $user, PageReference $title, $force='', $oldid=0)
Reset the notification timestamp of this entry.
isTempWatched(UserIdentity $user, PageReference $target)
Whether the page is only being watched temporarily (has expiry).
updateNotificationTimestamp(UserIdentity $editor, PageReference $target, $timestamp)
isWatched(UserIdentity $user, PageReference $target)
Must be called separately for Subject & Talk namespaces.
clearUserWatchedItemsUsingJobQueue(UserIdentity $user)
Queues a job that will clear the users watchlist using the Job Queue.
removeLabels(UserIdentity $user, array $targets, array $labels)
Remove labels from a set of watchlist items.
getWatchedItem(UserIdentity $user, PageReference $target)
Get an item (may be cached)
removeExpired(int $limit, bool $deleteOrphans=false)
Remove some number of expired watchlist items.
maybeEnqueueWatchlistExpiryJob()
Probabilistically add a job to purge the expired watchlist items, if watchlist expiration is enabled,...
countUnreadNotifications(UserIdentity $user, $unreadLimit=null)