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
94 array $targetsWithVisitThresholds,
95 $minimumWatchers = null
96 );
97
108 public function getWatchedItem( UserIdentity $user, PageReference $target );
109
120 public function loadWatchedItem( UserIdentity $user, PageReference $target );
121
132 public function loadWatchedItemsBatch( UserIdentity $user, array $targets );
133
147 public function getWatchedItemsForUser( UserIdentity $user, array $options = [] );
148
159 public function isWatched( UserIdentity $user, PageReference $target );
160
172 public function isTempWatched( UserIdentity $user, PageReference $target ): bool;
173
185 public function getNotificationTimestampsBatch( UserIdentity $user, array $targets );
186
198 public function addWatch( UserIdentity $user, PageReference $target, ?string $expiry = null );
199
211 public function addWatchBatchForUser( UserIdentity $user, array $targets, ?string $expiry = null );
212
224 public function removeWatch( UserIdentity $user, PageReference $target );
225
236 UserIdentity $user,
237 $timestamp,
238 array $targets = []
239 );
240
249 public function resetAllNotificationTimestampsForUser( UserIdentity $user, $timestamp = null );
250
262 UserIdentity $editor, PageReference $target, $timestamp );
263
280 UserIdentity $user, PageReference $title, $force = '', $oldid = 0 );
281
291 public function countUnreadNotifications( UserIdentity $user, $unreadLimit = null );
292
304 public function duplicateAllAssociatedEntries( PageReference $oldTarget, PageReference $newTarget );
305
318 public function duplicateEntry( PageReference $oldTarget, PageReference $newTarget );
319
329 public function clearUserWatchedItems( UserIdentity $user );
330
340 public function mustClearWatchedItemsUsingJobQueue( UserIdentity $user ): bool;
341
350
357 public function maybeEnqueueWatchlistExpiryJob(): void;
358
367 public function removeWatchBatchForUser( UserIdentity $user, array $targets );
368
383 $timestamp, UserIdentity $user, PageReference $target );
384
392 public function countExpired(): int;
393
404 public function removeExpired( int $limit, bool $deleteOrphans = false ): void;
405
415 public function addLabels( UserIdentity $user, array $targets, array $labels ): void;
416
426 public function removeLabels( UserIdentity $user, array $targets, array $labels ): void;
427}
429class_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)