Go to the documentation of this file.
36 parent::__construct(
$page, $restriction );
56 'mediawiki.special.changeslist.visitedstatus',
57 'mediawiki.special.watchlist',
61 if ( $mode !==
false ) {
81 if ( ( $config->get(
'EnotifWatchlist' ) || $config->get(
'ShowUpdatedMarker' ) )
86 $user->clearAllNotifications();
113 if ( isset( $filterDefinition[
'showHideSuffix'] ) ) {
114 $filterDefinition[
'showHide'] =
'wl' . $filterDefinition[
'showHideSuffix'];
117 return $filterDefinition;
124 parent::registerFilters();
129 $hideMinor = $significance->getFilter(
'hideminor' );
130 $hideMinor->setDefault(
$user->getBoolOption(
'watchlisthideminor' ) );
133 $hideBots = $automated->getFilter(
'hidebots' );
134 $hideBots->setDefault(
$user->getBoolOption(
'watchlisthidebots' ) );
137 $hideAnons = $registration->getFilter(
'hideanons' );
138 $hideAnons->setDefault(
$user->getBoolOption(
'watchlisthideanons' ) );
139 $hideLiu = $registration->getFilter(
'hideliu' );
140 $hideLiu->setDefault(
$user->getBoolOption(
'watchlisthideliu' ) );
143 if ( $reviewStatus !==
null ) {
145 $hidePatrolled = $reviewStatus->getFilter(
'hidepatrolled' );
146 $hidePatrolled->setDefault(
$user->getBoolOption(
'watchlisthidepatrolled' ) );
150 $hideMyself = $authorship->getFilter(
'hidemyself' );
151 $hideMyself->setDefault(
$user->getBoolOption(
'watchlisthideown' ) );
154 $hideCategorization = $changeType->getFilter(
'hidecategorization' );
155 if ( $hideCategorization !==
null ) {
157 $hideCategorization->setDefault(
$user->getBoolOption(
'watchlisthidecategorization' ) );
167 $opts = parent::getDefaultOptions();
171 $opts->add(
'extended',
$user->getBoolOption(
'extendwatchlist' ) );
182 if ( $this->customFilters ===
null ) {
183 $this->customFilters = parent::getCustomFilters();
184 Hooks::run(
'SpecialWatchlistFilters', [ $this, &$this->customFilters ],
'1.23' );
200 static $compatibilityMap = [
201 'hideMinor' =>
'hideminor',
202 'hideBots' =>
'hidebots',
203 'hideAnons' =>
'hideanons',
204 'hideLiu' =>
'hideliu',
205 'hidePatrolled' =>
'hidepatrolled',
206 'hideOwn' =>
'hidemyself',
210 foreach ( $compatibilityMap
as $from => $to ) {
211 if ( isset(
$params[$from] ) ) {
217 if ( $this->
getRequest()->getVal(
'action' ) ==
'submit' ) {
218 $allBooleansFalse = [];
226 foreach ( $this->filterGroups
as $filterGroup ) {
228 foreach ( $filterGroup->getFilters()
as $filter ) {
229 $allBooleansFalse[$filter->getName()] =
false;
240 $opts->fetchValuesFromRequest(
$request );
252 parent::buildQuery(
$tables, $fields, $conds, $query_options, $join_conds,
256 if ( $opts[
'days'] > 0 ) {
257 $conds[] =
'rc_timestamp > ' .
258 $dbr->addQuotes(
$dbr->timestamp( time() - intval( $opts[
'days'] * 86400 ) ) );
271 # Toggle watchlist content (all recent edits or just the latest)
272 if ( $opts[
'extended'] ) {
273 $limitWatchlist =
$user->getIntOption(
'wllimit' );
276 # Top log Ids for a page are not stored
277 $nonRevisionTypes = [
RC_LOG ];
278 Hooks::run(
'SpecialWatchlistGetNonRevisionTypes', [ &$nonRevisionTypes ] );
279 if ( $nonRevisionTypes ) {
280 $conds[] =
$dbr->makeList(
282 'rc_this_oldid=page_latest',
283 'rc_type' => $nonRevisionTypes,
292 $tables = array_merge( [
'recentchanges',
'watchlist' ],
$tables );
295 $query_options = array_merge( [
'ORDER BY' =>
'rc_timestamp DESC' ], $query_options );
296 $join_conds = array_merge(
301 'wl_user' =>
$user->getId(),
302 'wl_namespace=rc_namespace',
310 if ( $this->
getConfig()->get(
'ShowUpdatedMarker' ) ) {
311 $fields[] =
'wl_notificationtimestamp';
313 if ( $limitWatchlist ) {
314 $query_options[
'LIMIT'] = $limitWatchlist;
317 $rollbacker =
$user->isAllowed(
'rollback' );
318 if ( $usePage || $rollbacker ) {
320 $join_conds[
'page'] = [
'LEFT JOIN',
'rc_cur_id=page_id' ];
322 $fields[] =
'page_latest';
328 if ( !
$user->isAllowed(
'deletedhistory' ) ) {
330 } elseif ( !
$user->isAllowedAny(
'suppressrevision',
'viewsuppressed' ) ) {
336 $conds[] =
$dbr->makeList( [
338 $dbr->bitAnd(
'rc_deleted', $bitmask ) .
" != $bitmask",
366 return parent::runMainQueryHook(
$tables, $fields, $conds, $query_options, $join_conds, $opts )
368 'SpecialWatchlistQuery',
369 [ &$conds, &
$tables, &$join_conds, &$fields, $opts ],
388 $wlToken =
$user->getTokenFromOption(
'watchlisttoken' );
391 'action' =>
'feedwatchlist',
393 'wlowner' =>
$user->getName(),
394 'wltoken' => $wlToken,
410 # Show a message about replica DB lag, if applicable
413 $output->showLagWarning( $lag );
416 # If no rows to display, show message before try to render the list
417 if ( $rows->numRows() == 0 ) {
419 "<div class='mw-changeslist-empty'>\n$1\n</div>",
'recentchanges-noresult'
424 $dbr->dataSeek( $rows, 0 );
427 $list->setWatchlistDivs();
428 $list->initChangesListRows( $rows );
429 $dbr->dataSeek( $rows, 0 );
431 if ( $this->
getConfig()->
get(
'RCShowWatchingUsers' )
432 &&
$user->getOption(
'shownumberswatching' )
434 $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
437 $s = $list->beginRecentChangesList();
438 $userShowHiddenCats = $this->
getUser()->getBoolOption(
'showhiddencats' );
440 foreach ( $rows
as $obj ) {
444 # Skip CatWatch entries for hidden cats based on user preference
447 !$userShowHiddenCats &&
448 $rc->getParam(
'hidden-cat' )
453 $rc->counter = $counter++;
455 if ( $this->
getConfig()->get(
'ShowUpdatedMarker' ) ) {
456 $updated = $obj->wl_notificationtimestamp;
461 if ( isset( $watchedItemStore ) ) {
462 $rcTitleValue =
new TitleValue( (
int)$obj->rc_namespace, $obj->rc_title );
463 $rc->numberofWatchingusers = $watchedItemStore->countWatchers( $rcTitleValue );
465 $rc->numberofWatchingusers = 0;
468 $changeLine = $list->recentChangesLine( $rc, $updated, $counter );
469 if ( $changeLine !==
false ) {
473 $s .= $list->endRecentChangesList();
489 $this->
msg(
'watchlistfor2',
$user->getName() )
499 if ( $opts[
'days'] > 0 ) {
500 $days = $opts[
'days'];
502 $days = $this->
getConfig()->get(
'RCMaxAge' ) / ( 3600 * 24 );
505 $wlInfo = $this->
msg(
'wlnote' )->numParams( $numRows, round( $days * 24 ) )->params(
507 )->parse() .
"<br />\n";
509 $nondefaults = $opts->getChangedValues();
510 $cutofflinks = $this->
msg(
'wlshowtime' ) .
' ' . $this->
cutoffselector( $opts );
512 # Spit out some control panel links
515 $namesOfDisplayedFilters = [];
517 if ( !$group->isPerGroupRequestParameter() ) {
518 foreach ( $group->getFilters()
as $filterName => $filter ) {
519 if ( $filter->displaysOnUnstructuredUi( $this ) ) {
520 $namesOfDisplayedFilters[] = $filterName;
523 $filter->getShowHide(),
532 $hiddenFields = $nondefaults;
533 $hiddenFields[
'action'] =
'submit';
534 unset( $hiddenFields[
'namespace'] );
535 unset( $hiddenFields[
'invert'] );
536 unset( $hiddenFields[
'associated'] );
537 unset( $hiddenFields[
'days'] );
538 foreach ( $namesOfDisplayedFilters
as $filterName ) {
539 unset( $hiddenFields[$filterName] );
545 # Namespace filter and put the whole form together.
547 $form .= $cutofflinks;
548 $form .= $this->
msg(
'watchlist-hide' ) .
549 $this->
msg(
'colon-separator' )->escaped() .
550 implode(
' ', $links );
551 $form .=
"\n<br />\n";
554 'selected' => $opts[
'namespace'],
556 'label' => $this->
msg(
'namespace' )->
text()
558 'name' =>
'namespace',
560 'class' =>
'namespaceselector',
564 $this->
msg(
'invert' )->
text(),
568 [
'title' => $this->
msg(
'tooltip-invert' )->
text() ]
571 $this->
msg(
'namespace_association' )->
text(),
575 [
'title' => $this->
msg(
'tooltip-namespace_association' )->
text() ]
578 foreach ( $hiddenFields
as $key =>
$value ) {
594 $days = array_map(
'strval', [ 1/24, 2/24, 6/24, 12/24, 1, 3, 7 ] );
596 $userWatchlistOption = (
string)$this->
getUser()->getOption(
'watchlistdays' );
598 if ( !in_array( $userWatchlistOption, $days ) && $userWatchlistOption !==
'0' ) {
599 $days[] = $userWatchlistOption;
602 $maxDays = (
string)( $this->
getConfig()->get(
'RCMaxAge' ) / ( 3600 * 24 ) );
604 if ( !in_array( $maxDays, $days ) ) {
609 if ( $selected <= 0 ) {
610 $selected = $maxDays;
614 if ( !in_array( $selected, $days ) ) {
618 $select =
new XmlSelect(
'days',
'days', $selected );
623 $name = $this->
msg(
'hours' )->numParams( $value * 24 )->text();
625 $name = $this->
msg(
'days' )->numParams( $value )->text();
630 return $select->getHTML() .
"\n<br />\n";
639 $showUpdatedMarker = $this->
getConfig()->get(
'ShowUpdatedMarker' );
643 if ( $numItems == 0 ) {
644 $form .= $this->
msg(
'nowatchlist' )->parse() .
"\n";
646 $form .= $this->
msg(
'watchlist-details' )->numParams( $numItems )->parse() .
"\n";
647 if ( $this->
getConfig()->
get(
'EnotifWatchlist' )
648 &&
$user->getOption(
'enotifwatchlistpages' )
650 $form .= $this->
msg(
'wlheader-enotif' )->parse() .
"\n";
652 if ( $showUpdatedMarker ) {
653 $form .= $this->
msg(
'wlheader-showupdated' )->parse() .
"\n";
658 if ( $numItems > 0 && $showUpdatedMarker ) {
661 'id' =>
'mw-watchlist-resetbutton' ] ) .
"\n" .
663 [
'name' =>
'mw-watchlist-reset-submit' ] ) .
"\n" .
666 foreach ( $nondefaults
as $key =>
$value ) {
675 'id' =>
'mw-watchlist-form'
679 $this->
msg(
'watchlist-options' )->
text(),
681 [
'id' =>
'mw-watchlist-options' ]
693 $this->
msg( $message,
'' )->
text(),
708 $store = MediaWikiServices::getInstance()->getWatchedItemStore();
709 $count = $store->countWatchedItems( $this->
getUser() );
710 return floor( $count / 2 );
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.
error also a ContextSource you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
error also a ContextSource you ll probably need to make sure the header is varied on $request
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
getOutput()
Get the OutputPage being used for this instance.
if(!isset( $args[0])) $lang
makeLegend()
Return the legend displayed within the fieldset.
wfGetLB( $wiki=false)
Get a load balancer 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
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
getDB()
Return a IDatabase object for reading.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Special page which uses a ChangesList to show query results.
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
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Allows to change the fields on the form that will be generated $name
__construct( $page='Watchlist', $restriction='viewmywatchlist')
getDefaultOptions()
Get a FormOptions object containing the default options.
getLanguage()
Shortcut to get user's language.
doHeader( $opts, $numRows)
Set the text to be displayed above the changes.
static openElement( $element, $attribs=null)
This opens an XML element.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
doMainQuery( $tables, $fields, $conds, $query_options, $join_conds, FormOptions $opts)
Process the query.Array of tables; see IDatabase::select $table Array of fields; see IDatabase::selec...
Class for generating HTML <select> or <datalist> elements.
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
transformFilterDefinition(array $filterDefinition)
Transforms filter definition to prepare it for constructor.See overrides of this method as well....
getConfig()
Shortcut to get main config object.
namespace and then decline to actually register it file or subcat img or subcat $title
addFeedLinks( $params)
Adds RSS/atom links.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
countItems()
Count the number of paired items on a user's watchlist.
getFilterGroups()
Gets the currently registered filters groups.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object & $output
cutoffselector( $options)
getUser()
Shortcut to get the User executing this instance.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
registerFilters()
Register all filters and their groups (including those from hooks), plus handle conflicts and default...
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
getContext()
Gets the context this SpecialPage is executed in.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
A special page that lists last changes made to the wiki, limited to user-defined list of titles.
static newFromContext(IContextSource $context, array $groups=[])
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
execute( $subpage)
Main execution point.
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.
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
getFilterGroup( $groupName)
Gets a specified ChangesListFilterGroup by name.
getRequest()
Get the WebRequest being used for this instance.
outputFeedLinks()
Output feed links.
static buildTools( $lang, LinkRenderer $linkRenderer=null)
Build a set of links for convenient navigation between watchlist viewing and editing modes.
doesWrites()
Indicates whether this special page may perform database writes.
If the group is active, any unchecked filters will translate to hide parameters in the URL.
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.
buildQuery(&$tables, &$fields, &$conds, &$query_options, &$join_conds, FormOptions $opts)
Sets appropriate tables, fields, conditions, etc.depending on which filters the user requested....
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
runMainQueryHook(&$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts)
getCustomFilters()
Get all custom filters.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
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.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
showHideCheck( $options, $message, $name, $value)
setBottomText(FormOptions $opts)
Send the text to be displayed after the options.
getOptions()
Get the current FormOptions for this request.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
the array() calling protocol came about after MediaWiki 1.4rc1.
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Represents a page (or page fragment) title within MediaWiki.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out