Go to the documentation of this file.
31 public function __construct( $page =
'Watchlist', $restriction =
'viewmywatchlist' ) {
32 parent::__construct( $page, $restriction );
41 global $wgEnotifWatchlist, $wgShowUpdatedMarker;
50 if ( $mode !==
false ) {
69 if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker )
70 && $request->getVal(
'reset' )
71 && $request->wasPosted()
73 $user->clearAllNotifications();
88 $opts = parent::getDefaultOptions();
93 $opts->add(
'hideminor',
$user->getBoolOption(
'watchlisthideminor' ) );
94 $opts->add(
'hidebots',
$user->getBoolOption(
'watchlisthidebots' ) );
95 $opts->add(
'hideanons',
$user->getBoolOption(
'watchlisthideanons' ) );
96 $opts->add(
'hideliu',
$user->getBoolOption(
'watchlisthideliu' ) );
97 $opts->add(
'hidepatrolled',
$user->getBoolOption(
'watchlisthidepatrolled' ) );
98 $opts->add(
'hidemyself',
$user->getBoolOption(
'watchlisthideown' ) );
100 $opts->add(
'extended',
$user->getBoolOption(
'extendwatchlist' ) );
111 if ( $this->customFilters ===
null ) {
112 $this->customFilters = parent::getCustomFilters();
113 wfRunHooks(
'SpecialWatchlistFilters',
array( $this, &$this->customFilters ),
'1.23' );
129 static $compatibilityMap =
array(
130 'hideMinor' =>
'hideminor',
131 'hideBots' =>
'hidebots',
132 'hideAnons' =>
'hideanons',
133 'hideLiu' =>
'hideliu',
134 'hidePatrolled' =>
'hidepatrolled',
135 'hideOwn' =>
'hidemyself',
139 foreach ( $compatibilityMap
as $from => $to ) {
149 $opts->fetchValuesFromRequest( $request );
162 $conds = parent::buildMainQueryConds( $opts );
165 if ( $opts[
'days'] > 0 ) {
166 $conds[] =
'rc_timestamp > ' .
167 $dbr->addQuotes(
$dbr->timestamp( time() - intval( $opts[
'days'] * 86400 ) ) );
181 global $wgShowUpdatedMarker;
186 # Toggle watchlist content (all recent edits or just the latest)
187 if ( $opts[
'extended'] ) {
188 $limitWatchlist =
$user->getIntOption(
'wllimit' );
191 # Top log Ids for a page are not stored
193 wfRunHooks(
'SpecialWatchlistGetNonRevisionTypes',
array( &$nonRevisionTypes ) );
194 if ( $nonRevisionTypes ) {
195 $conds[] =
$dbr->makeList(
197 'rc_this_oldid=page_latest',
198 'rc_type' => $nonRevisionTypes,
209 $query_options =
array(
'ORDER BY' =>
'rc_timestamp DESC' );
211 'watchlist' =>
array(
214 'wl_user' =>
$user->getId(),
215 'wl_namespace=rc_namespace',
221 if ( $wgShowUpdatedMarker ) {
222 $fields[] =
'wl_notificationtimestamp';
224 if ( $limitWatchlist ) {
225 $query_options[
'LIMIT'] = $limitWatchlist;
228 $rollbacker =
$user->isAllowed(
'rollback' );
229 if ( $usePage || $rollbacker ) {
231 $join_conds[
'page'] =
array(
'LEFT JOIN',
'rc_cur_id=page_id' );
233 $fields[] =
'page_latest';
239 if ( !
$user->isAllowed(
'deletedhistory' ) ) {
241 } elseif ( !
$user->isAllowed(
'suppressrevision' ) ) {
249 $dbr->bitAnd(
'rc_deleted', $bitmask ) .
" != $bitmask",
263 array( &$conds, &
$tables, &$join_conds, &$fields, $opts ),
290 $wlToken =
$user->getTokenFromOption(
'watchlisttoken' );
293 'action' =>
'feedwatchlist',
295 'wlowner' =>
$user->getName(),
296 'wltoken' => $wlToken,
308 global $wgShowUpdatedMarker, $wgRCShowWatchingUsers;
314 # Show a message about slave lag, if applicable
317 $output->showLagWarning( $lag );
320 $dbr->dataSeek( $rows, 0 );
323 $list->setWatchlistDivs();
324 $list->initChangesListRows( $rows );
325 $dbr->dataSeek( $rows, 0 );
327 $s = $list->beginRecentChangesList();
329 foreach ( $rows
as $obj ) {
332 $rc->counter = $counter++;
334 if ( $wgShowUpdatedMarker ) {
335 $updated = $obj->wl_notificationtimestamp;
340 if ( $wgRCShowWatchingUsers &&
$user->getOption(
'shownumberswatching' ) ) {
341 $rc->numberofWatchingusers =
$dbr->selectField(
'watchlist',
344 'wl_namespace' => $obj->rc_namespace,
345 'wl_title' => $obj->rc_title,
349 $rc->numberofWatchingusers = 0;
352 $changeLine = $list->recentChangesLine( $rc, $updated, $counter );
353 if ( $changeLine !==
false ) {
357 $s .= $list->endRecentChangesList();
359 if ( $rows->numRows() == 0 ) {
361 "<div class='mw-changeslist-empty'>\n$1\n</div>",
'recentchanges-noresult'
378 $this->
msg(
'watchlistfor2',
$user->getName() )
386 if ( $opts[
'days'] > 0 ) {
388 $wlInfo = $this->
msg(
'wlnote2' )->numParams( round( $opts[
'days'] * 24 ) )->params(
390 )->parse() .
"<br />\n";
393 $nondefaults = $opts->getChangedValues();
394 $cutofflinks = $this->
cutoffLinks( $opts[
'days'], $nondefaults ) .
"<br />\n";
396 # Spit out some control panel links
398 'hideminor' =>
'rcshowhideminor',
399 'hidebots' =>
'rcshowhidebots',
400 'hideanons' =>
'rcshowhideanons',
401 'hideliu' =>
'rcshowhideliu',
402 'hidemyself' =>
'rcshowhidemine',
403 'hidepatrolled' =>
'rcshowhidepatr'
406 $filters[$key] =
$params[
'msg'];
409 if ( !
$user->useNPPatrol() ) {
410 unset( $filters[
'hidepatrolled'] );
414 foreach ( $filters
as $name => $msg ) {
418 $hiddenFields = $nondefaults;
419 unset( $hiddenFields[
'namespace'] );
420 unset( $hiddenFields[
'invert'] );
421 unset( $hiddenFields[
'associated'] );
426 # Namespace filter and put the whole form together.
428 $form .= $cutofflinks;
429 $form .= $lang->pipeList( $links ) .
"\n";
430 $form .=
"<hr />\n<p>";
433 'selected' => $opts[
'namespace'],
435 'label' => $this->
msg(
'namespace' )->
text()
437 'name' =>
'namespace',
439 'class' =>
'namespaceselector',
443 $this->
msg(
'invert' )->
text(),
447 array(
'title' => $this->
msg(
'tooltip-invert' )->
text() )
450 $this->
msg(
'namespace_association' )->
text(),
454 array(
'title' => $this->
msg(
'tooltip-namespace_association' )->
text() )
457 foreach ( $hiddenFields
as $key =>
$value ) {
468 global $wgEnotifWatchlist, $wgShowUpdatedMarker;
479 if ( $numItems == 0 ) {
480 $form .= $this->
msg(
'nowatchlist' )->parse() .
"\n";
482 $form .= $this->
msg(
'watchlist-details' )->numParams( $numItems )->parse() .
"\n";
483 if ( $wgEnotifWatchlist &&
$user->getOption(
'enotifwatchlistpages' ) ) {
484 $form .= $this->
msg(
'wlheader-enotif' )->parse() .
"\n";
486 if ( $wgShowUpdatedMarker ) {
487 $form .= $this->
msg(
'wlheader-showupdated' )->parse() .
"\n";
492 if ( $numItems > 0 && $wgShowUpdatedMarker ) {
495 'id' =>
'mw-watchlist-resetbutton' ) ) .
"\n" .
498 foreach ( $nondefaults
as $key =>
$value ) {
507 'id' =>
'mw-watchlist-form'
510 $this->
msg(
'watchlist-options' )->
text(),
512 array(
'id' =>
'mw-watchlist-options' )
521 $label = $this->
msg(
$value ?
'show' :
'hide' )->escaped();
524 return $this->
msg( $message )
542 $message = $d ? $this->
getLanguage()->formatNum( $d )
543 : $this->
msg(
'watchlistall2' )->escaped();
561 $hours =
array( 1, 2, 6, 12 );
562 $days =
array( 1, 3, 7 );
564 foreach ( $hours
as $h ) {
568 foreach ( $days
as $d ) {
572 return $this->
msg(
'wlshowlast' )->rawParams(
585 # Fetch the raw count
586 $rows =
$dbr->select(
'watchlist',
array(
'count' =>
'COUNT(*)' ),
587 array(
'wl_user' => $this->
getUser()->getId() ), __METHOD__ );
588 $row =
$dbr->fetchObject( $rows );
591 return floor(
$count / 2 );
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base reque...
getPageTitle( $subpage=false)
Get a self-referential title object.
const EDIT_CLEAR
Editing modes.
static newFromContext(IContextSource $context)
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
doMainQuery( $conds, $opts)
Process the query.
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
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
getOutput()
Get the OutputPage being used for this instance.
wfGetLB( $wiki=false)
Get a load balancer object.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
getDB()
Return a DatabaseBase object for reading.
Special page which uses a ChangesList to show query results.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
static buildTools( $unused)
Build a set of links for convenient navigation between watchlist viewing and editing modes.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
__construct( $page='Watchlist', $restriction='viewmywatchlist')
getDefaultOptions()
Get a FormOptions object containing the default options.
getLanguage()
Shortcut to get user's language.
requireLogin( $reasonMsg=null, $titleMsg=null)
If the user is not logged in, throws UserNotLoggedIn error.
static openElement( $element, $attribs=null)
This opens an XML element.
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
static makeLegend(IContextSource $context)
Return the legend displayed within the fieldset.
addFeedLinks( $params)
Adds RSS/atom links.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
getUser()
Shortcut to get the User executing this instance.
when a variable name is used in a it is silently declared as a new masking the global
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
doHeader( $opts)
Return the text to be displayed above the changes.
getContext()
Gets the context this SpecialPage is executed in.
A special page that lists last changes made to the wiki, limited to user-defined list of titles.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
presenting them properly to the user as errors is done by the caller $title
execute( $subpage)
Main execution point.
Allows to change the fields on the form that will be generated $name
static getMode( $request, $par)
Determine whether we are editing the watchlist, and if so, what kind of editing operation.
msg()
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
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
outputFeedLinks()
Output feed links.
countItems( $dbr)
Count the number of items on a user's watchlist.
static selectFields()
Return the list of recentchanges fields that should be selected to create a new recentchanges object.
static closeElement( $element)
Shortcut to close an XML element.
outputChangesList( $rows, $opts)
Build and output the actual changes list.
hoursLink( $h, $options=array())
daysLink( $d, $options=array())
buildMainQueryConds(FormOptions $opts)
Return an array of conditions depending of options set in $opts.
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
static namespaceSelector(array $params=array(), array $selectAttribs=array())
Build a drop-down box for selecting a namespace.
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
getCustomFilters()
Get custom show/hide filters.
setTopText(FormOptions $opts)
Send the text to be displayed before the options.
fetchOptionsFromRequest( $opts)
Fetch values for a FormOptions object from the WebRequest associated with this instance.
setBottomText(FormOptions $opts)
Send the text to be displayed after the options.
getOptions()
Get the current FormOptions for this request.
showHideLink( $options, $message, $name, $value)
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.
cutoffLinks( $days, $options=array())
Returns html.