Go to the documentation of this file.
60 $wl->mCheckRights = $checkRights;
78 return $this->
getTitle()->getNamespace();
86 return $this->
getTitle()->getDBkey();
94 return $this->mUser->getId();
115 if ( $this->loaded ) {
118 $this->loaded =
true;
121 if ( $this->mUser->isAnon() ) {
122 $this->watched =
false;
127 if ( !$this->
getTitle()->isWatchable() ) {
128 $this->watched =
false;
132 # Pages and their talk pages are considered equivalent for watching;
133 # remember that talk namespaces are numbered as page namespace+1.
136 $row =
$dbr->selectRow(
'watchlist',
'wl_notificationtimestamp',
137 $this->
dbCond(), __METHOD__ );
139 if ( $row ===
false ) {
140 $this->watched =
false;
142 $this->watched =
true;
143 $this->timestamp = $row->wl_notificationtimestamp;
152 return !$this->mCheckRights || $this->mUser->isAllowed( $what );
160 if ( !$this->
isAllowed(
'viewmywatchlist' ) ) {
175 if ( !$this->
isAllowed(
'viewmywatchlist' ) ) {
180 if ( $this->watched ) {
200 if ( $force !=
'force' ) {
202 if ( !$this->watched || $this->timestamp ===
null ) {
210 $notificationTimestamp =
null;
211 } elseif ( !
$title->getNextRevisionID( $oldid ) ) {
213 $notificationTimestamp =
null;
219 if ( $this->timestamp ===
null ) {
221 $notificationTimestamp =
null;
226 $notificationTimestamp =
$dbr->selectField(
227 'revision',
'rev_timestamp',
228 array(
'rev_page' =>
$title->getArticleID(),
'rev_id' => $oldid )
233 $ts->timestamp->add(
new DateInterval(
'PT1S' ) );
234 $notificationTimestamp = $ts->getTimestamp(
TS_MW );
236 if ( $notificationTimestamp < $this->timestamp ) {
237 if ( $force !=
'force' ) {
250 $dbw->update(
'watchlist',
array(
'wl_notificationtimestamp' => $notificationTimestamp ),
251 $this->
dbCond(), __METHOD__ );
252 $this->timestamp =
null;
272 $dbw->insert(
'watchlist',
277 'wl_notificationtimestamp' =>
null
278 ), __METHOD__,
'IGNORE' );
282 $dbw->insert(
'watchlist',
287 'wl_notificationtimestamp' =>
null
288 ), __METHOD__,
'IGNORE' );
290 $this->watched =
true;
311 $dbw->delete(
'watchlist',
318 if ( $dbw->affectedRows() ) {
322 # the following code compensates the new behavior, introduced by the
323 # enotif patch, that every single watched page needs now to be listed
324 # in watchlist namespace:page and namespace_talk:page had separate
325 # entries: clear them
326 $dbw->delete(
'watchlist',
334 if ( $dbw->affectedRows() ) {
338 $this->watched =
false;
365 $oldnamespace = $ot->getNamespace();
366 $newnamespace = $nt->getNamespace();
367 $oldtitle = $ot->getDBkey();
368 $newtitle = $nt->getDBkey();
371 $res = $dbw->select(
'watchlist',
'wl_user',
372 array(
'wl_namespace' => $oldnamespace,
'wl_title' => $oldtitle ),
373 __METHOD__,
'FOR UPDATE'
375 # Construct array to replace into the watchlist
379 'wl_user' =>
$s->wl_user,
380 'wl_namespace' => $newnamespace,
381 'wl_title' => $newtitle
385 if ( empty( $values ) ) {
391 # Note that multi-row replace is very efficient for MySQL but may be inefficient for
392 # some other DBMSes, mostly due to poor simulation by us
393 $dbw->replace(
'watchlist',
array(
array(
'wl_user',
'wl_namespace',
'wl_title' ) ), $values, __METHOD__ );
Library for creating and parsing MW-style timestamps.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
isWatched()
Is mTitle being watched by mUser?
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
wfProfileIn( $functionname)
Begin profiling of a function.
wfReadOnly()
Check whether the wiki is in read-only mode.
removeWatch()
Same as addWatch, only the opposite.
getTitle()
Title being watched.
static fromUserTitle( $user, $title, $checkRights=WatchedItem::CHECK_USER_RIGHTS)
Create a WatchedItem object with the given user and title.
const IGNORE_USER_RIGHTS
Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should not be checked.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
static duplicateEntries( $ot, $nt)
Check if the given title already is watched by the user, and if so add watches on a new title.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
load()
Load the object from the database.
dbCond()
Return an array of conditions to select or update the appropriate database row.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
presenting them properly to the user as errors is done by the caller $title
getUserId()
Helper to retrieve the user id.
Representation of a pair of user and title for watchlist entries.
const CHECK_USER_RIGHTS
Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should be checked.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
resetNotificationTimestamp( $force='', $oldid=0)
Reset the notification timestamp of this entry.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
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.
getTitleDBkey()
Helper to retrieve the title DBkey.
static getTalk( $index)
Get the talk namespace index for a given namespace.
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
getTitleNs()
Helper to retrieve the title namespace.
isAllowed( $what)
Check permissions.
static doDuplicateEntries( $ot, $nt)
Handle duplicate entries.