34 parent::__construct(
$page, $restriction );
54 'mediawiki.special.changeslist.visitedstatus',
58 if ( $mode !==
false ) {
78 if ( ( $config->get(
'EnotifWatchlist' ) || $config->get(
'ShowUpdatedMarker' ) )
82 $user->clearAllNotifications();
111 $opts = parent::getDefaultOptions();
115 $opts->add(
'extended',
$user->getBoolOption(
'extendwatchlist' ) );
116 if ( $this->
getRequest()->getVal(
'action' ) ==
'submit' ) {
121 $opts->add(
'hideminor',
$user->getBoolOption(
'watchlisthideminor' ) );
122 $opts->add(
'hidebots',
$user->getBoolOption(
'watchlisthidebots' ) );
123 $opts->add(
'hideanons',
$user->getBoolOption(
'watchlisthideanons' ) );
124 $opts->add(
'hideliu',
$user->getBoolOption(
'watchlisthideliu' ) );
125 $opts->add(
'hidepatrolled',
$user->getBoolOption(
'watchlisthidepatrolled' ) );
126 $opts->add(
'hidemyself',
$user->getBoolOption(
'watchlisthideown' ) );
127 $opts->add(
'hidecategorization',
$user->getBoolOption(
'watchlisthidecategorization' ) );
138 if ( $this->customFilters === null ) {
139 $this->customFilters = parent::getCustomFilters();
140 Hooks::run(
'SpecialWatchlistFilters', [ $this, &$this->customFilters ],
'1.23' );
156 static $compatibilityMap = [
157 'hideMinor' =>
'hideminor',
158 'hideBots' =>
'hidebots',
159 'hideAnons' =>
'hideanons',
160 'hideLiu' =>
'hideliu',
161 'hidePatrolled' =>
'hidepatrolled',
162 'hideOwn' =>
'hidemyself',
166 foreach ( $compatibilityMap
as $from => $to ) {
176 $opts->fetchValuesFromRequest(
$request );
189 $conds = parent::buildMainQueryConds( $opts );
192 if ( $opts[
'days'] > 0 ) {
193 $conds[] =
'rc_timestamp > ' .
194 $dbr->addQuotes(
$dbr->timestamp( time() - intval( $opts[
'days'] * 86400 ) ) );
211 # Toggle watchlist content (all recent edits or just the latest)
212 if ( $opts[
'extended'] ) {
213 $limitWatchlist =
$user->getIntOption(
'wllimit' );
216 # Top log Ids for a page are not stored
217 $nonRevisionTypes = [
RC_LOG ];
218 Hooks::run(
'SpecialWatchlistGetNonRevisionTypes', [ &$nonRevisionTypes ] );
219 if ( $nonRevisionTypes ) {
220 $conds[] =
$dbr->makeList(
222 'rc_this_oldid=page_latest',
223 'rc_type' => $nonRevisionTypes,
232 $tables = [
'recentchanges',
'watchlist' ];
234 $query_options = [
'ORDER BY' =>
'rc_timestamp DESC' ];
239 'wl_user' =>
$user->getId(),
240 'wl_namespace=rc_namespace',
246 if ( $this->
getConfig()->
get(
'ShowUpdatedMarker' ) ) {
247 $fields[] =
'wl_notificationtimestamp';
249 if ( $limitWatchlist ) {
250 $query_options[
'LIMIT'] = $limitWatchlist;
253 $rollbacker =
$user->isAllowed(
'rollback' );
254 if ( $usePage || $rollbacker ) {
256 $join_conds[
'page'] = [
'LEFT JOIN',
'rc_cur_id=page_id' ];
258 $fields[] =
'page_latest';
264 if ( !
$user->isAllowed(
'deletedhistory' ) ) {
266 } elseif ( !
$user->isAllowedAny(
'suppressrevision',
'viewsuppressed' ) ) {
272 $conds[] =
$dbr->makeList( [
274 $dbr->bitAnd(
'rc_deleted', $bitmask ) .
" != $bitmask",
302 return parent::runMainQueryHook(
$tables, $fields, $conds, $query_options, $join_conds, $opts )
304 'SpecialWatchlistQuery',
305 [ &$conds, &
$tables, &$join_conds, &$fields, $opts ],
324 $wlToken =
$user->getTokenFromOption(
'watchlisttoken' );
327 'action' =>
'feedwatchlist',
329 'wlowner' =>
$user->getName(),
330 'wltoken' => $wlToken,
346 # Show a message about slave lag, if applicable
349 $output->showLagWarning( $lag );
352 # If no rows to display, show message before try to render the list
353 if ( $rows->numRows() == 0 ) {
355 "<div class='mw-changeslist-empty'>\n$1\n</div>",
'recentchanges-noresult'
360 $dbr->dataSeek( $rows, 0 );
363 $list->setWatchlistDivs();
364 $list->initChangesListRows( $rows );
365 $dbr->dataSeek( $rows, 0 );
367 if ( $this->
getConfig()->
get(
'RCShowWatchingUsers' )
368 &&
$user->getOption(
'shownumberswatching' )
370 $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
373 $s = $list->beginRecentChangesList();
374 $userShowHiddenCats = $this->
getUser()->getBoolOption(
'showhiddencats' );
376 foreach ( $rows
as $obj ) {
380 # Skip CatWatch entries for hidden cats based on user preference
383 !$userShowHiddenCats &&
384 $rc->getParam(
'hidden-cat' )
389 $rc->counter = $counter++;
391 if ( $this->
getConfig()->get(
'ShowUpdatedMarker' ) ) {
392 $updated = $obj->wl_notificationtimestamp;
397 if ( isset( $watchedItemStore ) ) {
398 $rcTitleValue =
new TitleValue( (
int)$obj->rc_namespace, $obj->rc_title );
399 $rc->numberofWatchingusers = $watchedItemStore->countWatchers( $rcTitleValue );
401 $rc->numberofWatchingusers = 0;
404 $changeLine = $list->recentChangesLine( $rc, $updated, $counter );
405 if ( $changeLine !==
false ) {
409 $s .= $list->endRecentChangesList();
426 if (
$user->getBoolOption(
'watchlistreloadautomatically' ) ) {
427 $out->addModules( [
'mediawiki.special.watchlist' ] );
431 $this->
msg(
'watchlistfor2',
$user->getName() )
438 if ( $opts[
'days'] > 0 ) {
439 $days = $opts[
'days'];
441 $days = $this->
getConfig()->get(
'RCMaxAge' ) / ( 3600 * 24 );
444 $wlInfo = $this->
msg(
'wlnote' )->numParams( $numRows, round( $days * 24 ) )->params(
446 )->parse() .
"<br />\n";
448 $nondefaults = $opts->getChangedValues();
449 $cutofflinks = $this->
msg(
'wlshowtime' ) .
' ' . $this->
cutoffselector( $opts );
451 # Spit out some control panel links
453 'hideminor' =>
'wlshowhideminor',
454 'hidebots' =>
'wlshowhidebots',
455 'hideanons' =>
'wlshowhideanons',
456 'hideliu' =>
'wlshowhideliu',
457 'hidemyself' =>
'wlshowhidemine',
458 'hidepatrolled' =>
'wlshowhidepatr'
461 if ( $this->
getConfig()->
get(
'RCWatchCategoryMembership' ) ) {
462 $filters[
'hidecategorization'] =
'wlshowhidecategorization';
466 $filters[$key] =
$params[
'msg'];
469 if ( !
$user->useRCPatrol() ) {
470 unset( $filters[
'hidepatrolled'] );
474 foreach ( $filters
as $name => $msg ) {
478 $hiddenFields = $nondefaults;
479 $hiddenFields[
'action'] =
'submit';
480 unset( $hiddenFields[
'namespace'] );
481 unset( $hiddenFields[
'invert'] );
482 unset( $hiddenFields[
'associated'] );
483 unset( $hiddenFields[
'days'] );
484 foreach ( $filters
as $key =>
$value ) {
485 unset( $hiddenFields[$key] );
491 # Namespace filter and put the whole form together.
493 $form .= $cutofflinks;
494 $form .= $this->
msg(
'watchlist-hide' ) .
495 $this->
msg(
'colon-separator' )->escaped() .
496 implode(
' ', $links );
497 $form .=
"\n<br />\n";
500 'selected' => $opts[
'namespace'],
502 'label' => $this->
msg(
'namespace' )->
text()
504 'name' =>
'namespace',
506 'class' =>
'namespaceselector',
510 $this->
msg(
'invert' )->
text(),
514 [
'title' => $this->
msg(
'tooltip-invert' )->
text() ]
517 $this->
msg(
'namespace_association' )->
text(),
521 [
'title' => $this->
msg(
'tooltip-namespace_association' )->
text() ]
524 foreach ( $hiddenFields
as $key =>
$value ) {
540 $days = array_map(
'strval', [ 1/24, 2/24, 6/24, 12/24, 1, 3, 7 ] );
542 $userWatchlistOption = (
string)$this->
getUser()->getOption(
'watchlistdays' );
544 if ( !in_array( $userWatchlistOption, $days ) && $userWatchlistOption !==
'0' ) {
545 $days[] = $userWatchlistOption;
548 $maxDays = (
string)( $this->
getConfig()->get(
'RCMaxAge' ) / ( 3600 * 24 ) );
550 if ( !in_array( $maxDays, $days ) ) {
555 if ( $selected <= 0 ) {
556 $selected = $maxDays;
560 if ( !in_array( $selected, $days ) ) {
564 $select =
new XmlSelect(
'days',
'days', $selected );
569 $name = $this->
msg(
'hours' )->numParams( $value * 24 )->text();
571 $name = $this->
msg(
'days' )->numParams( $value )->text();
573 $select->addOption(
$name, $value );
576 return $select->getHTML() .
"\n<br />\n";
585 $showUpdatedMarker = $this->
getConfig()->get(
'ShowUpdatedMarker' );
589 if ( $numItems == 0 ) {
590 $form .= $this->
msg(
'nowatchlist' )->parse() .
"\n";
592 $form .= $this->
msg(
'watchlist-details' )->numParams( $numItems )->parse() .
"\n";
593 if ( $this->
getConfig()->
get(
'EnotifWatchlist' )
594 &&
$user->getOption(
'enotifwatchlistpages' )
596 $form .= $this->
msg(
'wlheader-enotif' )->parse() .
"\n";
598 if ( $showUpdatedMarker ) {
599 $form .= $this->
msg(
'wlheader-showupdated' )->parse() .
"\n";
604 if ( $numItems > 0 && $showUpdatedMarker ) {
607 'id' =>
'mw-watchlist-resetbutton' ] ) .
"\n" .
610 foreach ( $nondefaults
as $key =>
$value ) {
619 'id' =>
'mw-watchlist-form'
622 $this->
msg(
'watchlist-options' )->
text(),
624 [
'id' =>
'mw-watchlist-options' ]
636 $this->
msg( $message,
'' )->
text(),
651 $store = MediaWikiServices::getInstance()->getWatchedItemStore();
653 return floor(
$count / 2 );
static newFromContext(IContextSource $context)
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
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
getCustomFilters()
Get custom show/hide filters.
getContext()
Gets the context this SpecialPage is executed in.
showHideCheck($options, $message, $name, $value)
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
const EDIT_CLEAR
Editing modes.
outputChangesList($rows, $opts)
Build and output the actual changes list.
if(!isset($args[0])) $lang
Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base reque...
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Class for generating HTML <select> or <datalist> elements.
addFeedLinks($params)
Adds RSS/atom links.
getDB()
Return a IDatabase object for reading.
Represents a page (or page fragment) title within MediaWiki.
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
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
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getOptions()
Get the current FormOptions for this request.
static submitButton($value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
fetchOptionsFromRequest($opts)
Fetch values for a FormOptions object from the WebRequest associated with this instance.
static fieldset($legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
static closeElement($element)
Shortcut to close an XML element.
wfGetLB($wiki=false)
Get a load balancer object.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist 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
doMainQuery($conds, $opts)
Process the query.
countItems()
Count the number of paired items on a user's watchlist.
static openElement($element, $attribs=null)
This opens an XML element.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
doHeader($opts, $numRows)
Set the text to be displayed above the changes.
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead.&$feedLinks conditions will AND in the final query as a Content object as a Content object $title
static getMode($request, $par)
Determine whether we are editing the watchlist, and if so, what kind of editing operation.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
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
setBottomText(FormOptions $opts)
Send the text to be displayed after the options.
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 selectFields()
Return the list of recentchanges fields that should be selected to create a new recentchanges object...
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
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 local account $user
execute($subpage)
Main execution point.
static array static newFromRow($row)
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist 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
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
error also a ContextSource you ll probably need to make sure the header is varied on $request
Special page which uses a ChangesList to show query results.
outputFeedLinks()
Output feed links.
runMainQueryHook(&$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts)
requireLogin($reasonMsg= 'exception-nologin-text', $titleMsg= 'exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
getUser()
Shortcut to get the User executing this instance.
getConfig()
Shortcut to get main config object.
getLanguage()
Shortcut to get user's language.
static buildTools($unused)
Build a set of links for convenient navigation between watchlist viewing and editing modes...
static checkLabel($label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
buildMainQueryConds(FormOptions $opts)
Return an array of conditions depending of options set in $opts.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
getRequest()
Get the WebRequest being used for this instance.
makeLegend()
Return the legend displayed within the fieldset.
A special page that lists last changes made to the wiki, limited to user-defined list of titles...
getDefaultOptions()
Get a FormOptions object containing the default options.
setTopText(FormOptions $opts)
__construct($page= 'Watchlist', $restriction= 'viewmywatchlist')
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
getPageTitle($subpage=false)
Get a self-referential title object.
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
Allows to change the fields on the form that will be generated $name