MediaWiki
REL1_22
|
Representation of a pair of user and title for watchlist entries. More...
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= '') | |
Reset the notification timestamp of this entry. | |
Static Public Member Functions | |
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 | |
$mCheckRights | |
$mTitle | |
$mUser | |
$timestamp | |
$watched | |
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 | |
$loaded = false |
Representation of a pair of user and title for watchlist entries.
Definition at line 29 of file WatchedItem.php.
Given a title and user (assumes the object is setup), add the watch to the database.
Definition at line 203 of file WatchedItem.php.
References array(), MWNamespace\getSubject(), MWNamespace\getTalk(), getTitleDBkey(), getTitleNs(), getUserId(), isAllowed(), wfGetDB(), wfProfileIn(), wfProfileOut(), and wfReadOnly().
WatchedItem::dbCond | ( | ) | [private] |
Return an array of conditions to select or update the appropriate database row.
Definition at line 93 of file WatchedItem.php.
References array(), getTitleDBkey(), getTitleNs(), and getUserId().
Referenced by load(), and resetNotificationTimestamp().
static WatchedItem::doDuplicateEntries | ( | $ | ot, |
$ | nt | ||
) | [static, private] |
Handle duplicate entries.
Backend for duplicateEntries().
Definition at line 307 of file WatchedItem.php.
References $res, $s, array(), as, empty, and wfGetDB().
Referenced by duplicateEntries().
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.
$ot | Title: page title to duplicate entries from, if present |
$nt | Title: page title to add watches on |
Definition at line 294 of file WatchedItem.php.
References doDuplicateEntries().
Referenced by Title\moveTo().
static WatchedItem::fromUserTitle | ( | $ | user, |
$ | title, | ||
$ | checkRights = WatchedItem::CHECK_USER_RIGHTS |
||
) | [static] |
Create a WatchedItem object with the given user and title.
$user | User: the user to use for (un)watching |
$title | Title: the title we're going to (un)watch |
$checkRights | int: Whether to check the 'viewmywatchlist' and 'editmywatchlist' rights. Pass either WatchedItem::IGNORE_USER_RIGHTS or WatchedItem::CHECK_USER_RIGHTS. |
Definition at line 56 of file WatchedItem.php.
Get the notification timestamp of this entry.
Definition at line 158 of file WatchedItem.php.
References isAllowed(), and load().
WatchedItem::getTitle | ( | ) | [protected] |
Title being watched.
Definition at line 69 of file WatchedItem.php.
Referenced by getTitleDBkey(), and getTitleNs().
WatchedItem::getTitleDBkey | ( | ) | [protected] |
Helper to retrieve the title DBkey.
Definition at line 79 of file WatchedItem.php.
References getTitle().
Referenced by addWatch(), dbCond(), and removeWatch().
WatchedItem::getTitleNs | ( | ) | [protected] |
Helper to retrieve the title namespace.
Definition at line 74 of file WatchedItem.php.
References getTitle().
Referenced by addWatch(), dbCond(), and removeWatch().
WatchedItem::getUserId | ( | ) | [protected] |
Helper to retrieve the user id.
Definition at line 83 of file WatchedItem.php.
Referenced by addWatch(), dbCond(), and removeWatch().
WatchedItem::isAllowed | ( | $ | what | ) | [private] |
Check permissions.
$what | string: 'viewmywatchlist' or 'editmywatchlist' |
Definition at line 135 of file WatchedItem.php.
Referenced by addWatch(), getNotificationTimestamp(), isWatched(), removeWatch(), and resetNotificationTimestamp().
Is mTitle being watched by mUser?
Definition at line 143 of file WatchedItem.php.
References isAllowed(), and load().
WatchedItem::load | ( | ) | [private] |
Load the object from the database.
Definition at line 104 of file WatchedItem.php.
References $dbr, dbCond(), and wfGetDB().
Referenced by getNotificationTimestamp(), isWatched(), and resetNotificationTimestamp().
Same as addWatch, only the opposite.
Definition at line 243 of file WatchedItem.php.
References $success, array(), MWNamespace\getSubject(), MWNamespace\getTalk(), getTitleDBkey(), getTitleNs(), getUserId(), isAllowed(), wfGetDB(), wfProfileIn(), wfProfileOut(), and wfReadOnly().
WatchedItem::resetNotificationTimestamp | ( | $ | force = '' | ) |
Reset the notification timestamp of this entry.
$force | Whether to force the write query to be executed even if the page is not watched or the notification timestamp is already NULL. |
Definition at line 177 of file WatchedItem.php.
References array(), dbCond(), isAllowed(), load(), wfGetDB(), and wfReadOnly().
WatchedItem::$loaded = false [private] |
Definition at line 45 of file WatchedItem.php.
WatchedItem::$mCheckRights |
Definition at line 44 of file WatchedItem.php.
WatchedItem::$mTitle |
Definition at line 44 of file WatchedItem.php.
WatchedItem::$mUser |
Definition at line 44 of file WatchedItem.php.
WatchedItem::$timestamp |
Definition at line 45 of file WatchedItem.php.
WatchedItem::$watched |
Definition at line 45 of file WatchedItem.php.
const WatchedItem::CHECK_USER_RIGHTS = 1 |
Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should be checked.
Definition at line 42 of file WatchedItem.php.
const WatchedItem::IGNORE_USER_RIGHTS = 0 |
Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should not be checked.
Definition at line 35 of file WatchedItem.php.
Referenced by WatchAction\doWatch(), WatchAction\doWatchOrUnwatch(), ApiBase\getWatchlistValue(), UploadBase\performUpload(), and SpecialBlock\processForm().