Manual:WatchedItemStore.php
From Linux Web Expert
MediaWiki file: WatchedItemStore.php | |
---|---|
Location: | includes/ |
Source code: | master • 1.41.1 • 1.40.3 • 1.39.7 |
Classes: | WatchedItemStore |
WatchedItemStore
is the MediaWiki class that handles database interactions for Watchlist related functions.
Watchlist code in other parts of the core act as a wrapper for functions in this class.
Member functions
countWatchedItems()
- Count the number of individual items that are watched by the user. Counts subject and talk page separately.countWatchers()
- Count number of watchers for a given page.countWatchersMultiple()
- Count number of watchers for a given array of pages. Returns an array with watchers for each page.countVisitingWatchers()
- Number of watchers who have visited a recent edit of a page.countVisitingWatchersMultiple()
- Number of watchers of each page (from a given set of pages) who have visited recent edits to that page.getNotificationTimestamp()
- Retrieve the notification timestamp for an entry on the watchlist for a given user and page.getNotificationTimestampsBatch()
- Retrieve the notification timestamps for an array of given entries.getWatchedItem()
- Get a WatchedItem object for given user and LinkTarget object.getWatchedItemsForUser()
- Get all WatchedItems for a given user.isWatched()
- Check if a page is watched. Separate for subject and talk pages.loadWatchedItem()
- Loads a WatchedItem from DB with given user and LinkTarget values.removeWatch()
- Remove page from watchlist, given a user and LinkTarget.resetNotificationTimestamp()
- Reset notification timestamp for given user and page.setNotificationTimestampsForUser()
- Set a notification timestamp for given user and page.updateNotificationTimestamp()
- Update notification timestamp for given LinkTarget object. Accepts the editor user object to not update timestamp for them.
This list only covers the major functions. For a more complete list, refer to this auto-generated documentation page.
Example Usages
// Get notification timestamp for a watched item
use MediaWiki\MediaWikiServices;
$item = MediaWikiServices::getInstance()->getWatchedItemStore()->loadWatchedItem( $this->user, $this->linkTarget );
$this->notificationTimestamp = $item->getNotificationTimestamp();
// Count watched items for a given user
use MediaWiki\MediaWikiServices;
$store = MediaWikiServices::getInstance()->getWatchedItemStore();
$count = $store->countWatchedItems( $this->getUser() );