MediaWiki REL1_39
MediaWiki\Watchlist\WatchlistManager Class Reference

WatchlistManager service. More...

Public Member Functions

 __construct (ServiceOptions $options, HookContainer $hookContainer, ReadOnlyMode $readOnlyMode, RevisionLookup $revisionLookup, TalkPageNotificationManager $talkPageNotificationManager, WatchedItemStoreInterface $watchedItemStore, UserFactory $userFactory, NamespaceInfo $nsInfo, WikiPageFactory $wikiPageFactory)
 
 addWatch (Authority $performer, PageIdentity $target, ?string $expiry=null)
 Watch a page if the user has permission to edit their watchlist.
 
 addWatchIgnoringRights (UserIdentity $userIdentity, PageIdentity $target, ?string $expiry=null)
 Watch a page.
 
 clearAllUserNotifications ( $performer)
 Resets all of the given user's page-change notification timestamps.
 
 clearTitleUserNotifications ( $performer, $title, int $oldid=0, RevisionRecord $oldRev=null)
 Clear the user's notification timestamp for the given title.
 
 getTitleNotificationTimestamp (UserIdentity $user, $title)
 Get the timestamp when this page was updated since the user last saw it.
 
 isTempWatched (Authority $performer, PageIdentity $target)
 Check if the page is temporarily watched by the user and the user has permission to view their watchlist.
 
 isTempWatchedIgnoringRights (UserIdentity $userIdentity, PageIdentity $target)
 Check if the article is temporarily watched by the user.
 
 isWatchable (PageReference $target)
 
 isWatched (Authority $performer, PageIdentity $target)
 Check if the page is watched by the user and the user has permission to view their watchlist.
 
 isWatchedIgnoringRights (UserIdentity $userIdentity, PageIdentity $target)
 Check if the page is watched by the user.
 
 removeWatch (Authority $performer, PageIdentity $target)
 Stop watching a page if the user has permission to edit their watchlist.
 
 removeWatchIgnoringRights (UserIdentity $userIdentity, PageIdentity $target)
 Stop watching a page.
 
 setWatch (bool $watch, Authority $performer, PageIdentity $target, string $expiry=null)
 Watch or unwatch a page, calling watch/unwatch hooks as appropriate.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

WatchlistManager service.

Since
1.35

Definition at line 52 of file WatchlistManager.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Watchlist\WatchlistManager::__construct ( ServiceOptions $options,
HookContainer $hookContainer,
ReadOnlyMode $readOnlyMode,
RevisionLookup $revisionLookup,
TalkPageNotificationManager $talkPageNotificationManager,
WatchedItemStoreInterface $watchedItemStore,
UserFactory $userFactory,
NamespaceInfo $nsInfo,
WikiPageFactory $wikiPageFactory )
Parameters
ServiceOptions$options
HookContainer$hookContainer
ReadOnlyMode$readOnlyMode
RevisionLookup$revisionLookup
TalkPageNotificationManager$talkPageNotificationManager
WatchedItemStoreInterface$watchedItemStore
UserFactory$userFactory
NamespaceInfo$nsInfo
WikiPageFactory$wikiPageFactory

Definition at line 119 of file WatchlistManager.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ addWatch()

MediaWiki\Watchlist\WatchlistManager::addWatch ( Authority $performer,
PageIdentity $target,
?string $expiry = null )

Watch a page if the user has permission to edit their watchlist.

Calls the WatchArticle and WatchArticleComplete hooks.

Since
1.37
Parameters
Authority$performer
PageIdentity$target
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
StatusValue

Definition at line 410 of file WatchlistManager.php.

References User\newFatalPermissionDeniedStatus().

◆ addWatchIgnoringRights()

MediaWiki\Watchlist\WatchlistManager::addWatchIgnoringRights ( UserIdentity $userIdentity,
PageIdentity $target,
?string $expiry = null )

Watch a page.

Calls the WatchArticle and WatchArticleComplete hooks.

Since
1.37
Parameters
UserIdentity$userIdentity
PageIdentity$target
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
StatusValue

Definition at line 370 of file WatchlistManager.php.

◆ clearAllUserNotifications()

MediaWiki\Watchlist\WatchlistManager::clearAllUserNotifications ( $performer)

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
Authority | UserIdentity$performerdeprecated passing UserIdentity since 1.37

Definition at line 151 of file WatchlistManager.php.

References MediaWiki\MainConfigNames\EnotifUserTalk, MediaWiki\MainConfigNames\EnotifWatchlist, and MediaWiki\MainConfigNames\ShowUpdatedMarker.

◆ clearTitleUserNotifications()

MediaWiki\Watchlist\WatchlistManager::clearTitleUserNotifications ( $performer,
$title,
int $oldid = 0,
RevisionRecord $oldRev = null )

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
Authority | UserIdentity$performerdeprecated passing UserIdentity since 1.37
LinkTarget | PageIdentity$titledeprecated passing LinkTarget since 1.37
int$oldidThe revision id being viewed. If not given or 0, latest revision is assumed.
RevisionRecord | null$oldRevThe revision record associated with $oldid, or null if the latest revision is used

Definition at line 199 of file WatchlistManager.php.

References $title, MediaWiki\MainConfigNames\EnotifUserTalk, MediaWiki\MainConfigNames\EnotifWatchlist, NS_USER_TALK, and MediaWiki\MainConfigNames\ShowUpdatedMarker.

◆ getTitleNotificationTimestamp()

MediaWiki\Watchlist\WatchlistManager::getTitleNotificationTimestamp ( UserIdentity $user,
$title )

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

Parameters
UserIdentity$user
LinkTarget | PageIdentity$titledeprecated passing LinkTarget since 1.37
Returns
string|bool|null String timestamp, false if not watched, null if nothing is unseen

Definition at line 261 of file WatchlistManager.php.

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

◆ isTempWatched()

MediaWiki\Watchlist\WatchlistManager::isTempWatched ( Authority $performer,
PageIdentity $target )

Check if the page is temporarily watched by the user and the user has permission to view their watchlist.

Since
1.37
Parameters
Authority$performer
PageIdentity$target
Returns
bool

Definition at line 354 of file WatchlistManager.php.

References MediaWiki\Permissions\Authority\getUser().

◆ isTempWatchedIgnoringRights()

MediaWiki\Watchlist\WatchlistManager::isTempWatchedIgnoringRights ( UserIdentity $userIdentity,
PageIdentity $target )

Check if the article is temporarily watched by the user.

Since
1.37
Parameters
UserIdentity$userIdentity
PageIdentity$target
Returns
bool

Definition at line 339 of file WatchlistManager.php.

◆ isWatchable()

MediaWiki\Watchlist\WatchlistManager::isWatchable ( PageReference $target)
Since
1.37
Parameters
PageReference$target
Returns
bool

Definition at line 290 of file WatchlistManager.php.

◆ isWatched()

MediaWiki\Watchlist\WatchlistManager::isWatched ( Authority $performer,
PageIdentity $target )

Check if the page is watched by the user and the user has permission to view their watchlist.

Since
1.37
Parameters
Authority$performer
PageIdentity$target
Returns
bool

Definition at line 325 of file WatchlistManager.php.

References MediaWiki\Permissions\Authority\getUser().

◆ isWatchedIgnoringRights()

MediaWiki\Watchlist\WatchlistManager::isWatchedIgnoringRights ( UserIdentity $userIdentity,
PageIdentity $target )

Check if the page is watched by the user.

Since
1.37
Parameters
UserIdentity$userIdentity
PageIdentity$target
Returns
bool

Definition at line 310 of file WatchlistManager.php.

◆ removeWatch()

MediaWiki\Watchlist\WatchlistManager::removeWatch ( Authority $performer,
PageIdentity $target )

Stop watching a page if the user has permission to edit their watchlist.

Calls the UnwatchArticle and UnwatchArticleComplete hooks.

Since
1.37
Parameters
Authority$performer
PageIdentity$target
Returns
StatusValue

Definition at line 467 of file WatchlistManager.php.

References User\newFatalPermissionDeniedStatus().

◆ removeWatchIgnoringRights()

MediaWiki\Watchlist\WatchlistManager::removeWatchIgnoringRights ( UserIdentity $userIdentity,
PageIdentity $target )

Stop watching a page.

Calls the UnwatchArticle and UnwatchArticleComplete hooks.

Since
1.37
Parameters
UserIdentity$userIdentity
PageIdentity$target
Returns
StatusValue

Definition at line 430 of file WatchlistManager.php.

◆ setWatch()

MediaWiki\Watchlist\WatchlistManager::setWatch ( bool $watch,
Authority $performer,
PageIdentity $target,
string $expiry = null )

Watch or unwatch a page, calling watch/unwatch hooks as appropriate.

Checks before watching or unwatching to see if the page is already in the requested watch state and if the expiry is the same so it does not act unnecessarily.

Parameters
bool$watchWhether to watch or unwatch the page
Authority$performerwho is watching/unwatching
PageIdentity$targetPage to watch/unwatch
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
StatusValue
Since
1.37

Definition at line 492 of file WatchlistManager.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Watchlist\WatchlistManager::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const EnotifWatchlist
Name constant for the EnotifWatchlist setting, for use with Config::get()
const EnotifUserTalk
Name constant for the EnotifUserTalk setting, for use with Config::get()
const ShowUpdatedMarker
Name constant for the ShowUpdatedMarker setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 57 of file WatchlistManager.php.


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