MediaWiki  master
MediaWiki\User\TalkPageNotificationManager Class Reference

Manages user talk page notifications. More...

Collaboration diagram for MediaWiki\User\TalkPageNotificationManager:

Public Member Functions

 __construct (ServiceOptions $serviceOptions, ILoadBalancer $loadBalancer, ReadOnlyMode $readOnlyMode, RevisionLookup $revisionLookup, HookContainer $hookContainer, UserFactory $userFactory)
 
 clearForPageView (UserIdentity $user, RevisionRecord $oldRev=null)
 Clear notifications when the user's own talk page is viewed. More...
 
 clearInstanceCache (UserIdentity $user)
 Remove the cached newtalk status for the given user. More...
 
 getLatestSeenMessageTimestamp (UserIdentity $user)
 Returns the timestamp of the latest revision of the user talkpage that the user has already seen in TS_MW format. More...
 
 removeUserHasNewMessages (UserIdentity $user)
 Remove the new messages status. More...
 
 setUserHasNewMessages (UserIdentity $user, RevisionRecord $curRev=null)
 Update the talk page messages status. More...
 
 userHasNewMessages (UserIdentity $user)
 Check if the user has new messages. More...
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Private Member Functions

 dbCheckNewUserMessages (UserIdentity $user)
 Internal uncached check for new messages. More...
 
 dbDeleteNewUserMessages (UserIdentity $user)
 Clear the new messages flag for the given user. More...
 
 dbUpdateNewUserMessages (UserIdentity $user, RevisionRecord $curRev=null)
 Add or update the new messages flag. More...
 
 getCacheKey (UserIdentity $user)
 Gets a unique key for various caches. More...
 
 getQueryFieldAndId (UserIdentity $user)
 Get the field name and id for the user_newtalk table query. More...
 
 isTalkDisabled (UserIdentity $user)
 Check whether the talk page is disabled for a user. More...
 
 touchUser (UserIdentity $user)
 Update the user touched timestamp. More...
 

Private Attributes

bool $disableAnonTalk
 
HookRunner $hookRunner
 
ILoadBalancer $loadBalancer
 
ReadOnlyMode $readOnlyMode
 
RevisionLookup $revisionLookup
 
UserFactory $userFactory
 
array $userMessagesCache = []
 

Detailed Description

Manages user talk page notifications.

Since
1.35

Definition at line 39 of file TalkPageNotificationManager.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\TalkPageNotificationManager::__construct ( ServiceOptions  $serviceOptions,
ILoadBalancer  $loadBalancer,
ReadOnlyMode  $readOnlyMode,
RevisionLookup  $revisionLookup,
HookContainer  $hookContainer,
UserFactory  $userFactory 
)

Member Function Documentation

◆ clearForPageView()

MediaWiki\User\TalkPageNotificationManager::clearForPageView ( UserIdentity  $user,
RevisionRecord  $oldRev = null 
)

Clear notifications when the user's own talk page is viewed.

Parameters
UserIdentity$user
RevisionRecord | null$oldRevIf it is an old revision view, the old revision. If it is a current revision view, this should be null.

Definition at line 122 of file TalkPageNotificationManager.php.

References DeferredUpdates\addCallableUpdate().

◆ clearInstanceCache()

MediaWiki\User\TalkPageNotificationManager::clearInstanceCache ( UserIdentity  $user)

Remove the cached newtalk status for the given user.

Access: internal
There should be no need to call this other than from User::clearInstanceCache
Parameters
UserIdentity$user

Definition at line 249 of file TalkPageNotificationManager.php.

◆ dbCheckNewUserMessages()

MediaWiki\User\TalkPageNotificationManager::dbCheckNewUserMessages ( UserIdentity  $user)
private

Internal uncached check for new messages.

Parameters
UserIdentity$user
Returns
bool True if the user has new messages

Definition at line 268 of file TalkPageNotificationManager.php.

Referenced by MediaWiki\User\TalkPageNotificationManager\userHasNewMessages().

◆ dbDeleteNewUserMessages()

MediaWiki\User\TalkPageNotificationManager::dbDeleteNewUserMessages ( UserIdentity  $user)
private

Clear the new messages flag for the given user.

Parameters
UserIdentity$user
Returns
bool True if successful, false otherwise

Definition at line 322 of file TalkPageNotificationManager.php.

◆ dbUpdateNewUserMessages()

MediaWiki\User\TalkPageNotificationManager::dbUpdateNewUserMessages ( UserIdentity  $user,
RevisionRecord  $curRev = null 
)
private

Add or update the new messages flag.

Parameters
UserIdentity$user
RevisionRecord | null$curRevNew, as yet unseen revision of the user talk page. Ignored if null.
Returns
bool True if successful, false otherwise

Definition at line 287 of file TalkPageNotificationManager.php.

◆ getCacheKey()

MediaWiki\User\TalkPageNotificationManager::getCacheKey ( UserIdentity  $user)
private

Gets a unique key for various caches.

Parameters
UserIdentity$user
Returns
string

Definition at line 357 of file TalkPageNotificationManager.php.

◆ getLatestSeenMessageTimestamp()

MediaWiki\User\TalkPageNotificationManager::getLatestSeenMessageTimestamp ( UserIdentity  $user)

Returns the timestamp of the latest revision of the user talkpage that the user has already seen in TS_MW format.

If the user has no new messages, returns null

Parameters
UserIdentity$user
Returns
string|null

Definition at line 217 of file TalkPageNotificationManager.php.

◆ getQueryFieldAndId()

MediaWiki\User\TalkPageNotificationManager::getQueryFieldAndId ( UserIdentity  $user)
private

Get the field name and id for the user_newtalk table query.

Parameters
UserIdentity$user
Returns
array ( string $field, string|int $id )

Definition at line 341 of file TalkPageNotificationManager.php.

References MediaWiki\User\UserIdentity\getId().

◆ isTalkDisabled()

MediaWiki\User\TalkPageNotificationManager::isTalkDisabled ( UserIdentity  $user)
private

Check whether the talk page is disabled for a user.

Parameters
UserIdentity$user
Returns
bool

Definition at line 259 of file TalkPageNotificationManager.php.

Referenced by MediaWiki\User\TalkPageNotificationManager\userHasNewMessages().

◆ removeUserHasNewMessages()

MediaWiki\User\TalkPageNotificationManager::removeUserHasNewMessages ( UserIdentity  $user)

Remove the new messages status.

Parameters
UserIdentity$user

Definition at line 198 of file TalkPageNotificationManager.php.

◆ setUserHasNewMessages()

MediaWiki\User\TalkPageNotificationManager::setUserHasNewMessages ( UserIdentity  $user,
RevisionRecord  $curRev = null 
)

Update the talk page messages status.

Parameters
UserIdentity$user
RevisionRecord | null$curRevNew, as yet unseen revision of the user talk page. Null is acceptable in case the revision is not known. This will indicate that new messages exist, but will not affect the latest seen message timestamp

Definition at line 180 of file TalkPageNotificationManager.php.

◆ touchUser()

MediaWiki\User\TalkPageNotificationManager::touchUser ( UserIdentity  $user)
private

Update the user touched timestamp.

Parameters
UserIdentity$user

Definition at line 365 of file TalkPageNotificationManager.php.

◆ userHasNewMessages()

MediaWiki\User\TalkPageNotificationManager::userHasNewMessages ( UserIdentity  $user)

Check if the user has new messages.

Parameters
UserIdentity$user
Returns
bool whether the user has new messages

Definition at line 99 of file TalkPageNotificationManager.php.

References MediaWiki\User\TalkPageNotificationManager\dbCheckNewUserMessages(), and MediaWiki\User\TalkPageNotificationManager\isTalkDisabled().

Member Data Documentation

◆ $disableAnonTalk

bool MediaWiki\User\TalkPageNotificationManager::$disableAnonTalk
private

Definition at line 52 of file TalkPageNotificationManager.php.

◆ $hookRunner

HookRunner MediaWiki\User\TalkPageNotificationManager::$hookRunner
private

Definition at line 64 of file TalkPageNotificationManager.php.

◆ $loadBalancer

ILoadBalancer MediaWiki\User\TalkPageNotificationManager::$loadBalancer
private

◆ $readOnlyMode

ReadOnlyMode MediaWiki\User\TalkPageNotificationManager::$readOnlyMode
private

◆ $revisionLookup

RevisionLookup MediaWiki\User\TalkPageNotificationManager::$revisionLookup
private

◆ $userFactory

UserFactory MediaWiki\User\TalkPageNotificationManager::$userFactory
private

◆ $userMessagesCache

array MediaWiki\User\TalkPageNotificationManager::$userMessagesCache = []
private

Definition at line 49 of file TalkPageNotificationManager.php.

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\User\TalkPageNotificationManager::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const DisableAnonTalk
Name constant for the DisableAnonTalk setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 44 of file TalkPageNotificationManager.php.


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