MediaWiki master
WatchedItemStoreInterface.php
Go to the documentation of this file.
1<?php
22namespace MediaWiki\Watchlist;
23
27
33
37 public const SORT_ASC = 'ASC';
38
42 public const SORT_DESC = 'DESC';
43
54 public function countWatchedItems( UserIdentity $user );
55
63 public function countWatchers( $target );
64
75 public function countVisitingWatchers( $target, $threshold );
76
88 public function countWatchersMultiple( array $targets, array $options = [] );
89
112 array $targetsWithVisitThresholds,
113 $minimumWatchers = null
114 );
115
126 public function getWatchedItem( UserIdentity $user, $target );
127
138 public function loadWatchedItem( UserIdentity $user, $target );
139
150 public function loadWatchedItemsBatch( UserIdentity $user, array $targets );
151
166 public function getWatchedItemsForUser( UserIdentity $user, array $options = [] );
167
178 public function isWatched( UserIdentity $user, $target );
179
191 public function isTempWatched( UserIdentity $user, $target ): bool;
192
204 public function getNotificationTimestampsBatch( UserIdentity $user, array $targets );
205
217 public function addWatch( UserIdentity $user, $target, ?string $expiry = null );
218
230 public function addWatchBatchForUser( UserIdentity $user, array $targets, ?string $expiry = null );
231
243 public function removeWatch( UserIdentity $user, $target );
244
256 UserIdentity $user,
257 $timestamp,
258 array $targets = []
259 );
260
269 public function resetAllNotificationTimestampsForUser( UserIdentity $user, $timestamp = null );
270
283 UserIdentity $editor, $target, $timestamp );
284
301 UserIdentity $user, $title, $force = '', $oldid = 0 );
302
312 public function countUnreadNotifications( UserIdentity $user, $unreadLimit = null );
313
325 public function duplicateAllAssociatedEntries( $oldTarget, $newTarget );
326
339 public function duplicateEntry( $oldTarget, $newTarget );
340
350 public function clearUserWatchedItems( UserIdentity $user );
351
361 public function mustClearWatchedItemsUsingJobQueue( UserIdentity $user ): bool;
362
371
378 public function maybeEnqueueWatchlistExpiryJob(): void;
379
388 public function removeWatchBatchForUser( UserIdentity $user, array $targets );
389
404 $timestamp, UserIdentity $user, $target );
405
413 public function countExpired(): int;
414
425 public function removeExpired( int $limit, bool $deleteOrphans = false ): void;
426}
428class_alias( WatchedItemStoreInterface::class, 'WatchedItemStoreInterface' );
Represents the target of a wiki link.
Interface for objects (potentially) representing an editable wiki page.
Interface for objects representing user identity.
addWatch(UserIdentity $user, $target, ?string $expiry=null)
Must be called separately for Subject & Talk namespaces.
getWatchedItemsForUser(UserIdentity $user, array $options=[])
removeWatchBatchForUser(UserIdentity $user, array $targets)
countWatchersMultiple(array $targets, array $options=[])
removeWatch(UserIdentity $user, $target)
Removes an entry for the UserIdentity watching the target (LinkTarget or PageIdentity) Must be called...
getNotificationTimestampsBatch(UserIdentity $user, array $targets)
isWatched(UserIdentity $user, $target)
Must be called separately for Subject & Talk namespaces.
addWatchBatchForUser(UserIdentity $user, array $targets, ?string $expiry=null)
countExpired()
Get the number of watchlist items that expire before the current time.
updateNotificationTimestamp(UserIdentity $editor, $target, $timestamp)
countVisitingWatchers( $target, $threshold)
Number of page watchers who also visited a "recent" edit.
countWatchedItems(UserIdentity $user)
Count the number of individual items that are watched by the user.
setNotificationTimestampsForUser(UserIdentity $user, $timestamp, array $targets=[])
duplicateAllAssociatedEntries( $oldTarget, $newTarget)
Check if the given title already is watched by the user, and if so add a watch for the new title.
getWatchedItem(UserIdentity $user, $target)
Get an item (may be cached)
resetAllNotificationTimestampsForUser(UserIdentity $user, $timestamp=null)
Reset all watchlist notification timestamps for a user using the job queue.
isTempWatched(UserIdentity $user, $target)
Whether the page is only being watched temporarily (has expiry).
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.
loadWatchedItemsBatch(UserIdentity $user, array $targets)
Loads a set of WatchedItems from the db.
duplicateEntry( $oldTarget, $newTarget)
Check if the given title already is watched by the user, and if so add a watch for the new title.
getLatestNotificationTimestamp( $timestamp, UserIdentity $user, $target)
Convert $timestamp to TS_MW or return null if the page was visited since then by $user.
resetNotificationTimestamp(UserIdentity $user, $title, $force='', $oldid=0)
Reset the notification timestamp of this entry.
clearUserWatchedItemsUsingJobQueue(UserIdentity $user)
Queues a job that will clear the users watchlist using the Job Queue.
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)
loadWatchedItem(UserIdentity $user, $target)
Loads an item from the db.