MediaWiki REL1_37
|
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) | |
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 |
Private Attributes | |
HookRunner | $hookRunner |
array | $notificationTimestampCache = [] |
Cache for getTitleNotificationTimestamp. | |
NamespaceInfo | $nsInfo |
ServiceOptions | $options |
ReadOnlyMode | $readOnlyMode |
RevisionLookup | $revisionLookup |
TalkPageNotificationManager | $talkPageNotificationManager |
UserFactory | $userFactory |
WatchedItemStoreInterface | $watchedItemStore |
WikiPageFactory | $wikiPageFactory |
MediaWiki\Watchlist\WatchlistManager::__construct | ( | ServiceOptions | $options, |
HookContainer | $hookContainer, | ||
ReadOnlyMode | $readOnlyMode, | ||
RevisionLookup | $revisionLookup, | ||
TalkPageNotificationManager | $talkPageNotificationManager, | ||
WatchedItemStoreInterface | $watchedItemStore, | ||
UserFactory | $userFactory, | ||
NamespaceInfo | $nsInfo, | ||
WikiPageFactory | $wikiPageFactory | ||
) |
ServiceOptions | $options | |
HookContainer | $hookContainer | |
ReadOnlyMode | $readOnlyMode | |
RevisionLookup | $revisionLookup | |
TalkPageNotificationManager | $talkPageNotificationManager | |
WatchedItemStoreInterface | $watchedItemStore | |
UserFactory | $userFactory | |
NamespaceInfo | $nsInfo | |
WikiPageFactory | $wikiPageFactory |
Definition at line 118 of file WatchlistManager.php.
References MediaWiki\Watchlist\WatchlistManager\$nsInfo, MediaWiki\Watchlist\WatchlistManager\$options, MediaWiki\Watchlist\WatchlistManager\$readOnlyMode, MediaWiki\Watchlist\WatchlistManager\$revisionLookup, MediaWiki\Watchlist\WatchlistManager\$talkPageNotificationManager, MediaWiki\Watchlist\WatchlistManager\$userFactory, MediaWiki\Watchlist\WatchlistManager\$watchedItemStore, MediaWiki\Watchlist\WatchlistManager\$wikiPageFactory, and MediaWiki\Config\ServiceOptions\assertRequiredOptions().
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.
Authority | $performer | |
PageIdentity | $target | |
string | null | $expiry | Optional expiry timestamp in any format acceptable to wfTimestamp(), null will not create expiries, or leave them unchanged should they already exist. |
Definition at line 446 of file WatchlistManager.php.
References User\newFatalPermissionDeniedStatus().
Referenced by WatchAction\doWatch().
MediaWiki\Watchlist\WatchlistManager::addWatchIgnoringRights | ( | UserIdentity | $userIdentity, |
PageIdentity | $target, | ||
?string | $expiry = null |
||
) |
Watch a page.
Calls the WatchArticle and WatchArticleComplete hooks.
UserIdentity | $userIdentity | |
PageIdentity | $target | |
string | null | $expiry | Optional expiry timestamp in any format acceptable to wfTimestamp(), null will not create expiries, or leave them unchanged should they already exist. |
Definition at line 406 of file WatchlistManager.php.
Referenced by WatchAction\doWatch().
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.
Authority | UserIdentity | $performer | deprecated passing UserIdentity since 1.37 |
Definition at line 150 of file WatchlistManager.php.
MediaWiki\Watchlist\WatchlistManager::clearTitleUserNotifications | ( | $performer, | |
$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.
Authority | UserIdentity | $performer | deprecated passing UserIdentity since 1.37 |
LinkTarget | PageIdentity | $title | deprecated passing LinkTarget since 1.37 |
int | $oldid | The revision id being viewed. If not given or 0, latest revision is assumed. |
Definition at line 196 of file WatchlistManager.php.
References MediaWiki\Watchlist\WatchlistManager\$revisionLookup, MediaWiki\Watchlist\WatchlistManager\$talkPageNotificationManager, $title, MediaWiki\Revision\RevisionLookup\getNextRevision(), MediaWiki\Revision\RevisionLookup\getRevisionById(), NS_USER_TALK, MediaWiki\User\TalkPageNotificationManager\removeUserHasNewMessages(), MediaWiki\User\TalkPageNotificationManager\setUserHasNewMessages(), and MediaWiki\User\TalkPageNotificationManager\userHasNewMessages().
MediaWiki\Watchlist\WatchlistManager::getTitleNotificationTimestamp | ( | UserIdentity | $user, |
$title | |||
) |
Get the timestamp when this page was updated since the user last saw it.
UserIdentity | $user | |
LinkTarget | PageIdentity | $title | deprecated passing LinkTarget since 1.37 |
Definition at line 295 of file WatchlistManager.php.
References $title, and MediaWiki\User\UserIdentity\getId().
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.
Authority | $performer | |
PageIdentity | $target |
Definition at line 390 of file WatchlistManager.php.
References MediaWiki\Permissions\Authority\getUser().
MediaWiki\Watchlist\WatchlistManager::isTempWatchedIgnoringRights | ( | UserIdentity | $userIdentity, |
PageIdentity | $target | ||
) |
Check if the article is temporarily watched by the user.
UserIdentity | $userIdentity | |
PageIdentity | $target |
Definition at line 375 of file WatchlistManager.php.
MediaWiki\Watchlist\WatchlistManager::isWatchable | ( | PageReference | $target | ) |
PageReference | $target |
Definition at line 326 of file WatchlistManager.php.
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.
Authority | $performer | |
PageIdentity | $target |
Definition at line 361 of file WatchlistManager.php.
References MediaWiki\Permissions\Authority\getUser().
MediaWiki\Watchlist\WatchlistManager::isWatchedIgnoringRights | ( | UserIdentity | $userIdentity, |
PageIdentity | $target | ||
) |
Check if the page is watched by the user.
UserIdentity | $userIdentity | |
PageIdentity | $target |
Definition at line 346 of file WatchlistManager.php.
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.
Authority | $performer | |
PageIdentity | $target |
Definition at line 503 of file WatchlistManager.php.
References User\newFatalPermissionDeniedStatus().
MediaWiki\Watchlist\WatchlistManager::removeWatchIgnoringRights | ( | UserIdentity | $userIdentity, |
PageIdentity | $target | ||
) |
Stop watching a page.
Calls the UnwatchArticle and UnwatchArticleComplete hooks.
UserIdentity | $userIdentity | |
PageIdentity | $target |
Definition at line 466 of file WatchlistManager.php.
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.
bool | $watch | Whether to watch or unwatch the page |
Authority | $performer | who is watching/unwatching |
PageIdentity | $target | Page to watch/unwatch |
string | null | $expiry | Optional expiry timestamp in any format acceptable to wfTimestamp(), null will not create expiries, or leave them unchanged should they already exist. |
Definition at line 528 of file WatchlistManager.php.
|
private |
Definition at line 66 of file WatchlistManager.php.
|
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 105 of file WatchlistManager.php.
|
private |
Definition at line 84 of file WatchlistManager.php.
Referenced by MediaWiki\Watchlist\WatchlistManager\__construct().
|
private |
Definition at line 63 of file WatchlistManager.php.
Referenced by MediaWiki\Watchlist\WatchlistManager\__construct().
|
private |
Definition at line 69 of file WatchlistManager.php.
Referenced by MediaWiki\Watchlist\WatchlistManager\__construct().
|
private |
Definition at line 72 of file WatchlistManager.php.
Referenced by MediaWiki\Watchlist\WatchlistManager\__construct(), and MediaWiki\Watchlist\WatchlistManager\clearTitleUserNotifications().
|
private |
Definition at line 75 of file WatchlistManager.php.
Referenced by MediaWiki\Watchlist\WatchlistManager\__construct(), and MediaWiki\Watchlist\WatchlistManager\clearTitleUserNotifications().
|
private |
Definition at line 81 of file WatchlistManager.php.
Referenced by MediaWiki\Watchlist\WatchlistManager\__construct().
|
private |
Definition at line 78 of file WatchlistManager.php.
Referenced by MediaWiki\Watchlist\WatchlistManager\__construct().
|
private |
Definition at line 87 of file WatchlistManager.php.
Referenced by MediaWiki\Watchlist\WatchlistManager\__construct().
const MediaWiki\Watchlist\WatchlistManager::CONSTRUCTOR_OPTIONS |
Definition at line 57 of file WatchlistManager.php.