MediaWiki  REL1_24
WatchedItem Class Reference

Representation of a pair of user and title for watchlist entries. More...

Collaboration diagram for WatchedItem:

List of all members.

Public Member Functions

 addWatch ()
 Given a title and user (assumes the object is setup), add the watch to the database.
 getNotificationTimestamp ()
 Get the notification timestamp of this entry.
 isWatched ()
 Is mTitle being watched by mUser?
 removeWatch ()
 Same as addWatch, only the opposite.
 resetNotificationTimestamp ($force= '', $oldid=0)
 Reset the notification timestamp of this entry.

Static Public Member Functions

static batchAddWatch (array $items)
static duplicateEntries ($ot, $nt)
 Check if the given title already is watched by the user, and if so add watches on a new title.
static fromUserTitle ($user, $title, $checkRights=WatchedItem::CHECK_USER_RIGHTS)
 Create a WatchedItem object with the given user and title.

Public Attributes

int $mCheckRights
 *
Title $mTitle
 *
User $mUser
 *
const CHECK_USER_RIGHTS = 1
 Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should be checked.
const IGNORE_USER_RIGHTS = 0
 Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should not be checked.

Protected Member Functions

 getTitle ()
 Title being watched.
 getTitleDBkey ()
 Helper to retrieve the title DBkey.
 getTitleNs ()
 Helper to retrieve the title namespace.
 getUserId ()
 Helper to retrieve the user id.

Private Member Functions

 dbCond ()
 Return an array of conditions to select or update the appropriate database row.
 isAllowed ($what)
 Check permissions.
 load ()
 Load the object from the database.

Static Private Member Functions

static doDuplicateEntries ($ot, $nt)
 Handle duplicate entries.

Private Attributes

bool $loaded = false
 *
string $timestamp
 *
bool $watched
 *

Detailed Description

Representation of a pair of user and title for watchlist entries.

Definition at line 29 of file WatchedItem.php.


Member Function Documentation

Given a title and user (assumes the object is setup), add the watch to the database.

Returns:
bool

Definition at line 319 of file WatchedItem.php.

static WatchedItem::batchAddWatch ( array items) [static]
Parameters:
WatchedItem[]$items
Returns:
bool

Definition at line 271 of file WatchedItem.php.

WatchedItem::dbCond ( ) [private]

Return an array of conditions to select or update the appropriate database row.

Returns:
array

Definition at line 114 of file WatchedItem.php.

static WatchedItem::doDuplicateEntries ( ot,
nt 
) [static, private]

Handle duplicate entries.

Backend for duplicateEntries().

Parameters:
Title$ot
Title$nt
Returns:
bool

Definition at line 391 of file WatchedItem.php.

static WatchedItem::duplicateEntries ( ot,
nt 
) [static]

Check if the given title already is watched by the user, and if so add watches on a new title.

To be used for page renames and such.

Parameters:
Title$otPage title to duplicate entries from, if present
Title$ntPage title to add watches on

Definition at line 378 of file WatchedItem.php.

static WatchedItem::fromUserTitle ( user,
title,
checkRights = WatchedItem::CHECK_USER_RIGHTS 
) [static]

Create a WatchedItem object with the given user and title.

Since:
1.22 $checkRights parameter added
Parameters:
User$userThe user to use for (un)watching
Title$titleThe title we're going to (un)watch
int$checkRightsWhether to check the 'viewmywatchlist' and 'editmywatchlist' rights. Pass either WatchedItem::IGNORE_USER_RIGHTS or WatchedItem::CHECK_USER_RIGHTS.
Returns:
WatchedItem

Definition at line 65 of file WatchedItem.php.

Get the notification timestamp of this entry.

Returns:
bool|null|string False if the page is not watched, the value of the wl_notificationtimestamp field otherwise

Definition at line 186 of file WatchedItem.php.

WatchedItem::getTitle ( ) [protected]

Title being watched.

Returns:
Title

Definition at line 80 of file WatchedItem.php.

WatchedItem::getTitleDBkey ( ) [protected]

Helper to retrieve the title DBkey.

Returns:
string

Definition at line 96 of file WatchedItem.php.

WatchedItem::getTitleNs ( ) [protected]

Helper to retrieve the title namespace.

Returns:
int

Definition at line 88 of file WatchedItem.php.

WatchedItem::getUserId ( ) [protected]

Helper to retrieve the user id.

Returns:
int

Definition at line 104 of file WatchedItem.php.

WatchedItem::isAllowed ( what) [private]

Check permissions.

Parameters:
string$what'viewmywatchlist' or 'editmywatchlist'
Returns:
bool

Definition at line 163 of file WatchedItem.php.

Is mTitle being watched by mUser?

Returns:
bool

Definition at line 171 of file WatchedItem.php.

WatchedItem::load ( ) [private]

Load the object from the database.

Definition at line 125 of file WatchedItem.php.

Same as addWatch, only the opposite.

Returns:
bool

Definition at line 327 of file WatchedItem.php.

WatchedItem::resetNotificationTimestamp ( force = '',
oldid = 0 
)

Reset the notification timestamp of this entry.

Parameters:
bool$forceWhether to force the write query to be executed even if the page is not watched or the notification timestamp is already NULL.
int$oldidThe revision id being viewed. If not given or 0, latest revision is assumed.

Definition at line 206 of file WatchedItem.php.


Member Data Documentation

bool WatchedItem::$loaded = false [private]

*

Definition at line 50 of file WatchedItem.php.

int WatchedItem::$mCheckRights

*

Definition at line 48 of file WatchedItem.php.

Title WatchedItem::$mTitle

*

Definition at line 44 of file WatchedItem.php.

User WatchedItem::$mUser

*

Definition at line 46 of file WatchedItem.php.

string WatchedItem::$timestamp [private]

*

Definition at line 54 of file WatchedItem.php.

bool WatchedItem::$watched [private]

*

Definition at line 52 of file WatchedItem.php.

Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should be checked.

Since:
1.22

Definition at line 42 of file WatchedItem.php.

Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should not be checked.

Since:
1.22

Definition at line 35 of file WatchedItem.php.

Referenced by WatchAction\doWatch(), WatchAction\doWatchOrUnwatch(), RollbackAction\onView(), and UploadBase\performUpload().


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