MediaWiki
1.23.2
|
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. More... | |
getNotificationTimestamp () | |
Get the notification timestamp of this entry. More... | |
isWatched () | |
Is mTitle being watched by mUser? More... | |
removeWatch () | |
Same as addWatch, only the opposite. More... | |
resetNotificationTimestamp ( $force='', $oldid=0) | |
Reset the notification timestamp of this entry. More... | |
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. More... | |
static | fromUserTitle ( $user, $title, $checkRights=WatchedItem::CHECK_USER_RIGHTS) |
Create a WatchedItem object with the given user and title. More... | |
Public Attributes | |
$mCheckRights | |
$mTitle | |
$mUser | |
$timestamp | |
$watched | |
const | CHECK_USER_RIGHTS = 1 |
Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should be checked. More... | |
const | IGNORE_USER_RIGHTS = 0 |
Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should not be checked. More... | |
Protected Member Functions | |
getTitle () | |
Title being watched. More... | |
getTitleDBkey () | |
Helper to retrieve the title DBkey. More... | |
getTitleNs () | |
Helper to retrieve the title namespace. More... | |
getUserId () | |
Helper to retrieve the user id. More... | |
Private Member Functions | |
dbCond () | |
Return an array of conditions to select or update the appropriate database row. More... | |
isAllowed ( $what) | |
Check permissions. More... | |
load () | |
Load the object from the database. More... | |
Static Private Member Functions | |
static | doDuplicateEntries ( $ot, $nt) |
Handle duplicate entries. More... | |
Private Attributes | |
$loaded = false | |
Representation of a pair of user and title for watchlist entries.
Definition at line 29 of file WatchedItem.php.
WatchedItem::addWatch | ( | ) |
Given a title and user (assumes the object is setup), add the watch to the database.
Definition at line 260 of file WatchedItem.php.
References array(), DB_MASTER, MWNamespace\getSubject(), MWNamespace\getTalk(), getTitleDBkey(), getTitleNs(), getUserId(), isAllowed(), wfGetDB(), wfProfileIn(), wfProfileOut(), and wfReadOnly().
|
private |
Return an array of conditions to select or update the appropriate database row.
Definition at line 103 of file WatchedItem.php.
References array(), getTitleDBkey(), getTitleNs(), and getUserId().
Referenced by load(), and resetNotificationTimestamp().
|
staticprivate |
Handle duplicate entries.
Backend for duplicateEntries().
Definition at line 364 of file WatchedItem.php.
References $res, $s, array(), as, DB_MASTER, and wfGetDB().
Referenced by duplicateEntries().
|
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 351 of file WatchedItem.php.
References doDuplicateEntries().
Referenced by Title\moveTo().
|
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.
Referenced by User\getWatchedItem().
WatchedItem::getNotificationTimestamp | ( | ) |
Get the notification timestamp of this entry.
Definition at line 174 of file WatchedItem.php.
References $timestamp, isAllowed(), and load().
|
protected |
Title being watched.
Definition at line 69 of file WatchedItem.php.
References $mTitle.
Referenced by getTitleDBkey(), getTitleNs(), load(), and resetNotificationTimestamp().
|
protected |
Helper to retrieve the title DBkey.
Definition at line 85 of file WatchedItem.php.
References getTitle().
Referenced by addWatch(), dbCond(), and removeWatch().
|
protected |
Helper to retrieve the title namespace.
Definition at line 77 of file WatchedItem.php.
References getTitle().
Referenced by addWatch(), dbCond(), and removeWatch().
|
protected |
Helper to retrieve the user id.
Definition at line 93 of file WatchedItem.php.
Referenced by addWatch(), dbCond(), and removeWatch().
|
private |
Check permissions.
$what | string: 'viewmywatchlist' or 'editmywatchlist' |
Definition at line 151 of file WatchedItem.php.
Referenced by addWatch(), getNotificationTimestamp(), isWatched(), removeWatch(), and resetNotificationTimestamp().
WatchedItem::isWatched | ( | ) |
Is mTitle being watched by mUser?
Definition at line 159 of file WatchedItem.php.
References $watched, isAllowed(), and load().
|
private |
Load the object from the database.
Definition at line 114 of file WatchedItem.php.
References $dbr, DB_SLAVE, dbCond(), getTitle(), and wfGetDB().
Referenced by getNotificationTimestamp(), isWatched(), and resetNotificationTimestamp().
WatchedItem::removeWatch | ( | ) |
Same as addWatch, only the opposite.
Definition at line 300 of file WatchedItem.php.
References $success, array(), DB_MASTER, MWNamespace\getSubject(), MWNamespace\getTalk(), getTitleDBkey(), getTitleNs(), getUserId(), isAllowed(), wfGetDB(), wfProfileIn(), wfProfileOut(), and wfReadOnly().
WatchedItem::resetNotificationTimestamp | ( | $force = '' , |
|
$oldid = 0 |
|||
) |
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. | |
int | $oldid | The revision id being viewed. If not given or 0, latest revision is assumed. |
Definition at line 194 of file WatchedItem.php.
References $dbr, $timestamp, $title, array(), DB_MASTER, DB_SLAVE, dbCond(), getTitle(), isAllowed(), load(), TS_MW, wfGetDB(), and wfReadOnly().
|
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.
Referenced by getTitle().
WatchedItem::$mUser |
Definition at line 44 of file WatchedItem.php.
WatchedItem::$timestamp |
Definition at line 45 of file WatchedItem.php.
Referenced by getNotificationTimestamp(), and resetNotificationTimestamp().
WatchedItem::$watched |
Definition at line 45 of file WatchedItem.php.
Referenced by isWatched().
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(), LoginForm\initUser(), UploadBase\performUpload(), and SpecialBlock\processForm().