MediaWiki REL1_35
MediaWiki\User\WatchlistNotificationManager Class Reference

WatchlistNotificationManager service. More...

Collaboration diagram for MediaWiki\User\WatchlistNotificationManager:

Public Member Functions

 __construct (ServiceOptions $options, HookContainer $hookContainer, PermissionManager $permissionManager, ReadOnlyMode $readOnlyMode, RevisionLookup $revisionLookup, TalkPageNotificationManager $talkPageNotificationManager, WatchedItemStoreInterface $watchedItemStore)
 
 clearAllUserNotifications (UserIdentity $user)
 Resets all of the given user's page-change notification timestamps.
 
 clearTitleUserNotifications (UserIdentity $user, LinkTarget $title, int $oldid=0)
 Clear the user's notification timestamp for the given title.
 
 getTitleNotificationTimestamp (UserIdentity $user, LinkTarget $title)
 Get the timestamp when this page was updated since the user last saw it.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Private Attributes

HookRunner $hookRunner
 
array $notificationTimestampCache = []
 Cache for getTitleNotificationTimestamp.
 
ServiceOptions $options
 
PermissionManager $permissionManager
 
ReadOnlyMode $readOnlyMode
 
RevisionLookup $revisionLookup
 
TalkPageNotificationManager $talkPageNotificationManager
 
WatchedItemStoreInterface $watchedItemStore
 

Detailed Description

WatchlistNotificationManager service.

Since
1.35

Definition at line 40 of file WatchlistNotificationManager.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\WatchlistNotificationManager::__construct ( ServiceOptions  $options,
HookContainer  $hookContainer,
PermissionManager  $permissionManager,
ReadOnlyMode  $readOnlyMode,
RevisionLookup  $revisionLookup,
TalkPageNotificationManager  $talkPageNotificationManager,
WatchedItemStoreInterface  $watchedItemStore 
)

Member Function Documentation

◆ clearAllUserNotifications()

MediaWiki\User\WatchlistNotificationManager::clearAllUserNotifications ( UserIdentity  $user)

Resets all of the given user's page-change notification timestamps.

If e-notif e-mails are on, they will receive notification mails on the next change of any watched page.

Note
If the user doesn't have 'editmywatchlist', this will do nothing.
Parameters
UserIdentity$user

Definition at line 123 of file WatchlistNotificationManager.php.

References MediaWiki\User\UserIdentity\getId().

◆ clearTitleUserNotifications()

MediaWiki\User\WatchlistNotificationManager::clearTitleUserNotifications ( UserIdentity  $user,
LinkTarget  $title,
int  $oldid = 0 
)

Clear the user's notification timestamp for the given title.

If e-notif e-mails are on, they will receive notification mails on the next change of the page if it's watched etc.

Note
If the user doesn't have 'editmywatchlist', this will do nothing.
Parameters
UserIdentity$user
LinkTarget$title
int$oldidThe revision id being viewed. If not given or 0, latest revision is assumed.

Definition at line 163 of file WatchlistNotificationManager.php.

References MediaWiki\User\WatchlistNotificationManager\$revisionLookup, MediaWiki\User\WatchlistNotificationManager\$talkPageNotificationManager, $title, MediaWiki\User\UserIdentity\getName(), MediaWiki\Revision\RevisionLookup\getNextRevision(), MediaWiki\Revision\RevisionLookup\getRevisionById(), MediaWiki\User\UserIdentity\isRegistered(), NS_USER_TALK, MediaWiki\User\TalkPageNotificationManager\removeUserHasNewMessages(), MediaWiki\User\TalkPageNotificationManager\setUserHasNewMessages(), and MediaWiki\User\TalkPageNotificationManager\userHasNewMessages().

◆ getTitleNotificationTimestamp()

MediaWiki\User\WatchlistNotificationManager::getTitleNotificationTimestamp ( UserIdentity  $user,
LinkTarget  $title 
)

Get the timestamp when this page was updated since the user last saw it.

Parameters
UserIdentity$user
LinkTarget$title
Returns
string|bool|null String timestamp, false if not watched, null if nothing is unseen

Definition at line 254 of file WatchlistNotificationManager.php.

References $title, and MediaWiki\User\UserIdentity\getId().

Member Data Documentation

◆ $hookRunner

HookRunner MediaWiki\User\WatchlistNotificationManager::$hookRunner
private

Definition at line 51 of file WatchlistNotificationManager.php.

◆ $notificationTimestampCache

array MediaWiki\User\WatchlistNotificationManager::$notificationTimestampCache = []
private

Cache for getTitleNotificationTimestamp.

Keys need to reflect both the specific user and the title:

Since only users have watchlists, the user is represented with u⧼user id⧽

Since the method accepts LinkTarget objects, cannot rely on the object's toString, since it is different for TitleValue and Title. Implement a simplified string representation of the string that TitleValue uses: ⧼namespace number⧽:⧼db key⧽

Entries are in the form of u⧼user id⧽-⧼namespace number⧽:⧼db key⧽ => ⧼timestamp or false⧽

Definition at line 84 of file WatchlistNotificationManager.php.

◆ $options

ServiceOptions MediaWiki\User\WatchlistNotificationManager::$options
private

◆ $permissionManager

PermissionManager MediaWiki\User\WatchlistNotificationManager::$permissionManager
private

◆ $readOnlyMode

ReadOnlyMode MediaWiki\User\WatchlistNotificationManager::$readOnlyMode
private

◆ $revisionLookup

RevisionLookup MediaWiki\User\WatchlistNotificationManager::$revisionLookup
private

◆ $talkPageNotificationManager

TalkPageNotificationManager MediaWiki\User\WatchlistNotificationManager::$talkPageNotificationManager
private

◆ $watchedItemStore

WatchedItemStoreInterface MediaWiki\User\WatchlistNotificationManager::$watchedItemStore
private

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\User\WatchlistNotificationManager::CONSTRUCTOR_OPTIONS
Initial value:
= [
'UseEnotif',
'ShowUpdatedMarker',
]

Definition at line 42 of file WatchlistNotificationManager.php.


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