Manual:WatchedItem.php

From MediaWiki.org
Jump to navigation Jump to search

Other languages:
English • ‎日本語

The MediaWiki software's WatchedItem class represents watched items from the watchlist table.

Instantiation constructor[edit]

/**
 * @param User $user
 * @param LinkTarget $linkTarget
 * @param null|string $notificationTimestamp the value of the wl_notificationtimestamp field
 * @param bool|null $checkRights DO NOT USE - used internally for backward compatibility
*/
public function __construct(
	User $user,
	LinkTarget $linkTarget,
	$notificationTimestamp,
	$checkRights = null
) {
	$this->user = $user;
	$this->linkTarget = $linkTarget;
	$this->notificationTimestamp = $notificationTimestamp;
	if ( $checkRights !== null ) {
		$this->checkRights = $checkRights;
	}
}

Example instantiation[edit]

$item = new WatchedItem(
	$user,
	$target,
	$row->wl_notificationtimestamp
);

Member Functions[edit]

  • getUser() - It returns the user ID of the watched item user/watcher.
  • getLinkTarget() - It returns the LinkTarget class object for the watched page.
  • getNotificationTimestamp() - It returns the notification timestamp for the record on the watchlist table.
This class contains several deprecated functions for backward compatibility purposes. For a full list, check out WatchedItem.php. Most of these functions are wrappers for actual functions in WatchedItemStore class.