MediaWiki REL1_40
NoWriteWatchedItemStore Class Reference

Inherits WatchedItemStoreInterface.

Collaboration diagram for NoWriteWatchedItemStore:

Public Member Functions

 __construct (WatchedItemStoreInterface $actualStore)
 Initially set WatchedItemStore that will be used in cases where writing is not needed.
 
 addWatch (UserIdentity $user, $target, ?string $expiry=null)
 
 addWatchBatchForUser (UserIdentity $user, array $targets, ?string $expiry=null)
 
 clearUserWatchedItems (UserIdentity $user)
 Synchronously clear the users watchlist.
 
 clearUserWatchedItemsUsingJobQueue (UserIdentity $user)
 Queues a job that will clear the users watchlist using the Job Queue.
 
 countExpired ()
 Get the number of watchlist items that expire before the current time.
 
 countUnreadNotifications (UserIdentity $user, $unreadLimit=null)
 
 countVisitingWatchers ( $target, $threshold)
 
 countVisitingWatchersMultiple (array $targetsWithVisitThresholds, $minimumWatchers=null)
 
 countWatchedItems (UserIdentity $user)
 Count the number of individual items that are watched by the user.
 
 countWatchers ( $target)
 
 countWatchersMultiple (array $targets, array $options=[])
 
 duplicateAllAssociatedEntries ( $oldTarget, $newTarget)
 
 duplicateEntry ( $oldTarget, $newTarget)
 
 getLatestNotificationTimestamp ( $timestamp, UserIdentity $user, $target)
 
 getNotificationTimestampsBatch (UserIdentity $user, array $targets)
 
 getWatchedItem (UserIdentity $user, $target)
 
 getWatchedItemsForUser (UserIdentity $user, array $options=[])
 
 isTempWatched (UserIdentity $user, $target)
 
 isWatched (UserIdentity $user, $target)
 
 loadWatchedItem (UserIdentity $user, $target)
 
 loadWatchedItemsBatch (UserIdentity $user, array $targets)
 
 maybeEnqueueWatchlistExpiryJob ()
 Probabilistically add a job to purge the expired watchlist items, if watchlist expiration is enabled, based on the value of $wgWatchlistPurgeRate.
 
 mustClearWatchedItemsUsingJobQueue (UserIdentity $user)
 Does the size of the users watchlist require clearUserWatchedItemsUsingJobQueue() to be used instead of clearUserWatchedItems()
 
 removeExpired (int $limit, bool $deleteOrphans=false)
 Remove some number of expired watchlist items.
 
 removeWatch (UserIdentity $user, $target)
 
 removeWatchBatchForUser (UserIdentity $user, array $targets)
 
 resetAllNotificationTimestampsForUser (UserIdentity $user, $timestamp=null)
 Reset all watchlist notification timestamps for a user using the job queue.
 
 resetNotificationTimestamp (UserIdentity $user, $title, $force='', $oldid=0)
 
 setNotificationTimestampsForUser (UserIdentity $user, $timestamp, array $targets=[])
 
 updateNotificationTimestamp (UserIdentity $editor, $target, $timestamp)
 

Additional Inherited Members

- Public Attributes inherited from WatchedItemStoreInterface
const SORT_ASC = 'ASC'
 
const SORT_DESC = 'DESC'
 

Detailed Description

Access: internal
Since
1.31

Definition at line 32 of file NoWriteWatchedItemStore.php.

Constructor & Destructor Documentation

◆ __construct()

NoWriteWatchedItemStore::__construct ( WatchedItemStoreInterface $actualStore)

Initially set WatchedItemStore that will be used in cases where writing is not needed.

Parameters
WatchedItemStoreInterface$actualStore

Definition at line 45 of file NoWriteWatchedItemStore.php.

Member Function Documentation

◆ addWatch()

NoWriteWatchedItemStore::addWatch ( UserIdentity $user,
$target,
?string $expiry = null )
Parameters
UserIdentity$user
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
string | null$expiry

Implements WatchedItemStoreInterface.

Definition at line 198 of file NoWriteWatchedItemStore.php.

◆ addWatchBatchForUser()

NoWriteWatchedItemStore::addWatchBatchForUser ( UserIdentity $user,
array $targets,
?string $expiry = null )
Parameters
UserIdentity$user
LinkTarget[] | PageIdentity[]$targetsdeprecated passing LinkTarget[] since 1.36
string | null$expiryOptional expiry timestamp in any format acceptable to wfTimestamp(), null will not create expiries, or leave them unchanged should they already exist.
Returns
bool success

Implements WatchedItemStoreInterface.

Definition at line 210 of file NoWriteWatchedItemStore.php.

◆ clearUserWatchedItems()

NoWriteWatchedItemStore::clearUserWatchedItems ( UserIdentity $user)

Synchronously clear the users watchlist.

Since
1.31
Parameters
UserIdentity$user

Implements WatchedItemStoreInterface.

Definition at line 274 of file NoWriteWatchedItemStore.php.

◆ clearUserWatchedItemsUsingJobQueue()

NoWriteWatchedItemStore::clearUserWatchedItemsUsingJobQueue ( UserIdentity $user)

Queues a job that will clear the users watchlist using the Job Queue.

Since
1.31
Parameters
UserIdentity$user

Implements WatchedItemStoreInterface.

Definition at line 282 of file NoWriteWatchedItemStore.php.

◆ countExpired()

NoWriteWatchedItemStore::countExpired ( )

Get the number of watchlist items that expire before the current time.

Since
1.35
Returns
int

Implements WatchedItemStoreInterface.

Definition at line 311 of file NoWriteWatchedItemStore.php.

◆ countUnreadNotifications()

NoWriteWatchedItemStore::countUnreadNotifications ( UserIdentity $user,
$unreadLimit = null )
Since
1.31
Parameters
UserIdentity$user
int | null$unreadLimit
Returns
int|bool The number of unread notifications true if greater than or equal to $unreadLimit

Implements WatchedItemStoreInterface.

Definition at line 173 of file NoWriteWatchedItemStore.php.

◆ countVisitingWatchers()

NoWriteWatchedItemStore::countVisitingWatchers ( $target,
$threshold )
Parameters
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
mixed$threshold
Returns
int
Exceptions
MWException

Implements WatchedItemStoreInterface.

Definition at line 67 of file NoWriteWatchedItemStore.php.

◆ countVisitingWatchersMultiple()

NoWriteWatchedItemStore::countVisitingWatchersMultiple ( array $targetsWithVisitThresholds,
$minimumWatchers = null )
Parameters
array$targetsWithVisitThresholdsarray of pairs (LinkTarget|PageIdentity $target, mixed $threshold), $threshold is:
  • a timestamp of the recent edit if $target exists (format accepted by wfTimestamp)
  • null if $target doesn't exist deprecated passing LinkTarget since 1.36
int | null$minimumWatchers
Returns
array multi-dimensional like $return[$namespaceId][$titleString] = $watchers, where $watchers is an int:
  • if the page exists, number of users watching who have visited the page recently
  • if the page doesn't exist, number of users that have the page on their watchlist
  • 0 means there are no visiting watchers or their number is below the minimumWatchers option (if passed).

Implements WatchedItemStoreInterface.

Definition at line 102 of file NoWriteWatchedItemStore.php.

◆ countWatchedItems()

NoWriteWatchedItemStore::countWatchedItems ( UserIdentity $user)

Count the number of individual items that are watched by the user.

If a subject and corresponding talk page are watched this will return 2.

Since
1.31
Parameters
UserIdentity$user
Returns
int

Implements WatchedItemStoreInterface.

Definition at line 49 of file NoWriteWatchedItemStore.php.

◆ countWatchers()

NoWriteWatchedItemStore::countWatchers ( $target)
Parameters
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
Returns
int

Implements WatchedItemStoreInterface.

Definition at line 57 of file NoWriteWatchedItemStore.php.

◆ countWatchersMultiple()

NoWriteWatchedItemStore::countWatchersMultiple ( array $targets,
array $options = [] )
Parameters
LinkTarget[] | PageIdentity[]$targetsdeprecated passing LinkTarget[] since 1.36
array$optionsAllowed keys: 'minimumWatchers' => int
Returns
array multi dimensional like $return[$namespaceId][$titleString] = int $watchers All targets will be present in the result. 0 either means no watchers or the number of watchers was below the minimumWatchers option if passed.

Implements WatchedItemStoreInterface.

Definition at line 79 of file NoWriteWatchedItemStore.php.

◆ duplicateAllAssociatedEntries()

NoWriteWatchedItemStore::duplicateAllAssociatedEntries ( $oldTarget,
$newTarget )
Parameters
LinkTarget | PageIdentity$oldTargetdeprecated passing LinkTarget since 1.36
LinkTarget | PageIdentity$newTargetdeprecated passing LinkTarget since 1.36

Implements WatchedItemStoreInterface.

Definition at line 181 of file NoWriteWatchedItemStore.php.

◆ duplicateEntry()

NoWriteWatchedItemStore::duplicateEntry ( $oldTarget,
$newTarget )
Parameters
LinkTarget | PageIdentity$oldTargetdeprecated passing LinkTarget since 1.36
LinkTarget | PageIdentity$newTargetdeprecated passing LinkTarget since 1.36

Implements WatchedItemStoreInterface.

Definition at line 189 of file NoWriteWatchedItemStore.php.

◆ getLatestNotificationTimestamp()

NoWriteWatchedItemStore::getLatestNotificationTimestamp ( $timestamp,
UserIdentity $user,
$target )
Parameters
string | null$timestamp
UserIdentity$user
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
Returns
bool|string|null

Implements WatchedItemStoreInterface.

Definition at line 305 of file NoWriteWatchedItemStore.php.

References wfTimestampOrNull().

◆ getNotificationTimestampsBatch()

NoWriteWatchedItemStore::getNotificationTimestampsBatch ( UserIdentity $user,
array $targets )
Parameters
UserIdentity$user
LinkTarget[] | PageIdentity[]$targetsdeprecated passing LinkTarget[] since 1.36
Returns
array multi-dimensional like $return[$namespaceId][$titleString] = $timestamp, where $timestamp is:
  • string|null value of wl_notificationtimestamp,
  • false if $target is not watched by $user.

Implements WatchedItemStoreInterface.

Definition at line 169 of file NoWriteWatchedItemStore.php.

◆ getWatchedItem()

NoWriteWatchedItemStore::getWatchedItem ( UserIdentity $user,
$target )
Parameters
UserIdentity$user
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
Returns
false|WatchedItem

Implements WatchedItemStoreInterface.

Definition at line 117 of file NoWriteWatchedItemStore.php.

◆ getWatchedItemsForUser()

NoWriteWatchedItemStore::getWatchedItemsForUser ( UserIdentity $user,
array $options = [] )
Since
1.31 Method Added
1.35 Allows 'sortByExpiry' as a key in $options
Parameters
UserIdentity$user
array$optionsAllowed keys: 'forWrite' => bool defaults to false 'sort' => string optional sorting by namespace ID and title one of the self::SORT_* constants 'sortByExpiry' => bool optional sorts by expiration date, with the titles that will expire soonest at the top.
Returns
WatchedItem[]

Implements WatchedItemStoreInterface.

Definition at line 139 of file NoWriteWatchedItemStore.php.

◆ isTempWatched()

NoWriteWatchedItemStore::isTempWatched ( UserIdentity $user,
$target )
Parameters
UserIdentity$user
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
Returns
bool

Implements WatchedItemStoreInterface.

Definition at line 157 of file NoWriteWatchedItemStore.php.

◆ isWatched()

NoWriteWatchedItemStore::isWatched ( UserIdentity $user,
$target )
Parameters
UserIdentity$user
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
Returns
bool

Implements WatchedItemStoreInterface.

Definition at line 148 of file NoWriteWatchedItemStore.php.

◆ loadWatchedItem()

NoWriteWatchedItemStore::loadWatchedItem ( UserIdentity $user,
$target )
Parameters
UserIdentity$user
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
Returns
false|WatchedItem

Implements WatchedItemStoreInterface.

Definition at line 126 of file NoWriteWatchedItemStore.php.

◆ loadWatchedItemsBatch()

NoWriteWatchedItemStore::loadWatchedItemsBatch ( UserIdentity $user,
array $targets )
Parameters
UserIdentity$user
LinkTarget[] | PageIdentity[]$targetsdeprecated passing LinkTarget[] since 1.36
Returns
WatchedItem[]|false

Implements WatchedItemStoreInterface.

Definition at line 135 of file NoWriteWatchedItemStore.php.

◆ maybeEnqueueWatchlistExpiryJob()

NoWriteWatchedItemStore::maybeEnqueueWatchlistExpiryJob ( )

Probabilistically add a job to purge the expired watchlist items, if watchlist expiration is enabled, based on the value of $wgWatchlistPurgeRate.

Since
1.36

Implements WatchedItemStoreInterface.

Definition at line 286 of file NoWriteWatchedItemStore.php.

◆ mustClearWatchedItemsUsingJobQueue()

NoWriteWatchedItemStore::mustClearWatchedItemsUsingJobQueue ( UserIdentity $user)

Does the size of the users watchlist require clearUserWatchedItemsUsingJobQueue() to be used instead of clearUserWatchedItems()

Since
1.35
Parameters
UserIdentity$user
Returns
bool

Implements WatchedItemStoreInterface.

Definition at line 278 of file NoWriteWatchedItemStore.php.

◆ removeExpired()

NoWriteWatchedItemStore::removeExpired ( int $limit,
bool $deleteOrphans = false )

Remove some number of expired watchlist items.

Since
1.35
Parameters
int$limitThe number of items to remove.
bool$deleteOrphansWhether to also delete watchlist_expiry rows that have no related watchlist rows (because not all code knows about the expiry table yet). This runs two extra queries, so is only done from the purgeExpiredWatchlistItems.php maintenance script.

Implements WatchedItemStoreInterface.

Definition at line 315 of file NoWriteWatchedItemStore.php.

◆ removeWatch()

NoWriteWatchedItemStore::removeWatch ( UserIdentity $user,
$target )
Parameters
UserIdentity$user
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
Returns
bool|void

Implements WatchedItemStoreInterface.

Definition at line 223 of file NoWriteWatchedItemStore.php.

◆ removeWatchBatchForUser()

NoWriteWatchedItemStore::removeWatchBatchForUser ( UserIdentity $user,
array $targets )
Parameters
UserIdentity$user
LinkTarget[] | PageIdentity[]$targetsdeprecated passing LinkTarget[] since 1.36
Returns
bool success

Implements WatchedItemStoreInterface.

Definition at line 295 of file NoWriteWatchedItemStore.php.

◆ resetAllNotificationTimestampsForUser()

NoWriteWatchedItemStore::resetAllNotificationTimestampsForUser ( UserIdentity $user,
$timestamp = null )

Reset all watchlist notification timestamps for a user using the job queue.

Since
1.31
Parameters
UserIdentity$userThe user to reset the timestamps for
string | int | null$timestampValue to set all timestamps to, null to clear them

Implements WatchedItemStoreInterface.

Definition at line 254 of file NoWriteWatchedItemStore.php.

◆ resetNotificationTimestamp()

NoWriteWatchedItemStore::resetNotificationTimestamp ( UserIdentity $user,
$title,
$force = '',
$oldid = 0 )
Parameters
UserIdentity$user
LinkTarget | PageIdentity$titledeprecated passing LinkTarget since 1.36
string$force
int$oldid
Returns
bool|void

Implements WatchedItemStoreInterface.

Definition at line 265 of file NoWriteWatchedItemStore.php.

◆ setNotificationTimestampsForUser()

NoWriteWatchedItemStore::setNotificationTimestampsForUser ( UserIdentity $user,
$timestamp,
array $targets = [] )
Parameters
UserIdentity$userThe user to set the timestamps for
string | null$timestampSet the update timestamp to this value
LinkTarget[] | PageIdentity[]$targetsList of targets to update. Default to all targets. deprecated passing LinkTarget[] since 1.36
Returns
bool success

Implements WatchedItemStoreInterface.

Definition at line 234 of file NoWriteWatchedItemStore.php.

◆ updateNotificationTimestamp()

NoWriteWatchedItemStore::updateNotificationTimestamp ( UserIdentity $editor,
$target,
$timestamp )
Parameters
UserIdentity$editor
LinkTarget | PageIdentity$targetdeprecated passing LinkTarget since 1.36
string$timestamp
Returns
int[]|void

Implements WatchedItemStoreInterface.

Definition at line 248 of file NoWriteWatchedItemStore.php.


The documentation for this class was generated from the following file: