3 * Implements Special:Recentchanges
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @ingroup SpecialPage
25 * A special page that lists last changes made to the wiki
27 * @ingroup SpecialPage
29 class SpecialRecentChanges
extends IncludableSpecialPage
{
30 var $rcOptions, $rcSubpage;
31 protected $customFilters;
33 public function __construct( $name = 'Recentchanges' ) {
34 parent
::__construct( $name );
38 * Get a FormOptions object containing the default options
42 public function getDefaultOptions() {
43 $opts = new FormOptions();
45 $opts->add( 'days', (int)$this->getUser()->getOption( 'rcdays' ) );
46 $opts->add( 'limit', (int)$this->getUser()->getOption( 'rclimit' ) );
47 $opts->add( 'from', '' );
49 $opts->add( 'hideminor', $this->getUser()->getBoolOption( 'hideminor' ) );
50 $opts->add( 'hidebots', true );
51 $opts->add( 'hideanons', false );
52 $opts->add( 'hideliu', false );
53 $opts->add( 'hidepatrolled', $this->getUser()->getBoolOption( 'hidepatrolled' ) );
54 $opts->add( 'hidemyself', false );
56 $opts->add( 'namespace', '', FormOptions
::INTNULL
);
57 $opts->add( 'invert', false );
58 $opts->add( 'associated', false );
60 $opts->add( 'categories', '' );
61 $opts->add( 'categories_any', false );
62 $opts->add( 'tagfilter', '' );
67 * Create a FormOptions object with options as specified by the user
69 * @param $parameters array
73 public function setup( $parameters ) {
74 $opts = $this->getDefaultOptions();
76 foreach( $this->getCustomFilters() as $key => $params ) {
77 $opts->add( $key, $params['default'] );
80 $opts->fetchValuesFromRequest( $this->getRequest() );
82 // Give precedence to subpage syntax
83 if( $parameters !== null ) {
84 $this->parseParameters( $parameters, $opts );
87 $opts->validateIntBounds( 'limit', 0, 5000 );
92 * Get custom show/hide filters
94 * @return Array Map of filter URL param names to properties (msg/default)
96 protected function getCustomFilters() {
97 if ( $this->customFilters
=== null ) {
98 $this->customFilters
= array();
99 wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters
) );
101 return $this->customFilters
;
105 * Create a FormOptions object specific for feed requests and return it
107 * @return FormOptions
109 public function feedSetup() {
111 $opts = $this->getDefaultOptions();
112 $opts->fetchValuesFromRequest( $this->getRequest() );
113 $opts->validateIntBounds( 'limit', 0, $wgFeedLimit );
118 * Get the current FormOptions for this request
120 public function getOptions() {
121 if ( $this->rcOptions
=== null ) {
122 if ( $this->including() ) {
125 $isFeed = (bool)$this->getRequest()->getVal( 'feed' );
127 $this->rcOptions
= $isFeed ?
$this->feedSetup() : $this->setup( $this->rcSubpage
);
129 return $this->rcOptions
;
134 * Main execution point
136 * @param $subpage String
138 public function execute( $subpage ) {
139 $this->rcSubpage
= $subpage;
140 $feedFormat = $this->including() ?
null : $this->getRequest()->getVal( 'feed' );
142 # 10 seconds server-side caching max
143 $this->getOutput()->setSquidMaxage( 10 );
144 # Check if the client has a cached version
145 $lastmod = $this->checkLastModified( $feedFormat );
146 if( $lastmod === false ) {
150 $opts = $this->getOptions();
152 $this->outputHeader();
153 $this->addRecentChangesJS();
155 // Fetch results, prepare a batch link existence check query
156 $conds = $this->buildMainQueryConds( $opts );
157 $rows = $this->doMainQuery( $conds, $opts );
158 if( $rows === false ) {
159 if( !$this->including() ) {
160 $this->doHeader( $opts );
166 $batch = new LinkBatch
;
167 foreach( $rows as $row ) {
168 $batch->add( NS_USER
, $row->rc_user_text
);
169 $batch->add( NS_USER_TALK
, $row->rc_user_text
);
170 $batch->add( $row->rc_namespace
, $row->rc_title
);
175 list( $changesFeed, $formatter ) = $this->getFeedObject( $feedFormat );
176 $changesFeed->execute( $formatter, $rows, $lastmod, $opts );
178 $this->webOutput( $rows, $opts );
185 * Return an array with a ChangesFeed object and ChannelFeed object
189 public function getFeedObject( $feedFormat ) {
190 $changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
191 $formatter = $changesFeed->getFeedObject(
192 $this->msg( 'recentchanges' )->inContentLanguage()->text(),
193 $this->msg( 'recentchanges-feed-description' )->inContentLanguage()->text(),
194 $this->getTitle()->getFullURL()
196 return array( $changesFeed, $formatter );
200 * Process $par and put options found if $opts
201 * Mainly used when including the page
204 * @param $opts FormOptions
206 public function parseParameters( $par, FormOptions
$opts ) {
207 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
208 foreach( $bits as $bit ) {
209 if( 'hidebots' === $bit ) {
210 $opts['hidebots'] = true;
212 if( 'bots' === $bit ) {
213 $opts['hidebots'] = false;
215 if( 'hideminor' === $bit ) {
216 $opts['hideminor'] = true;
218 if( 'minor' === $bit ) {
219 $opts['hideminor'] = false;
221 if( 'hideliu' === $bit ) {
222 $opts['hideliu'] = true;
224 if( 'hidepatrolled' === $bit ) {
225 $opts['hidepatrolled'] = true;
227 if( 'hideanons' === $bit ) {
228 $opts['hideanons'] = true;
230 if( 'hidemyself' === $bit ) {
231 $opts['hidemyself'] = true;
234 if( is_numeric( $bit ) ) {
235 $opts['limit'] = $bit;
239 if( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
240 $opts['limit'] = $m[1];
242 if( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
243 $opts['days'] = $m[1];
245 if( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
246 $opts['namespace'] = $m[1];
252 * Get last modified date, for client caching
253 * Don't use this if we are using the patrol feature, patrol changes don't
254 * update the timestamp
256 * @param $feedFormat String
257 * @return String or false
259 public function checkLastModified( $feedFormat ) {
260 $dbr = wfGetDB( DB_SLAVE
);
261 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__
);
262 if( $feedFormat ||
!$this->getUser()->useRCPatrol() ) {
263 if( $lastmod && $this->getOutput()->checkLastModified( $lastmod ) ) {
264 # Client cache fresh and headers sent, nothing more to do.
272 * Return an array of conditions depending of options set in $opts
274 * @param $opts FormOptions
277 public function buildMainQueryConds( FormOptions
$opts ) {
278 $dbr = wfGetDB( DB_SLAVE
);
281 # It makes no sense to hide both anons and logged-in users
282 # Where this occurs, force anons to be shown
284 if( $opts['hideanons'] && $opts['hideliu'] ) {
285 # Check if the user wants to show bots only
286 if( $opts['hidebots'] ) {
287 $opts['hideanons'] = false;
290 $opts['hidebots'] = false;
295 $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
296 $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime %
86400);
297 $cutoff = $dbr->timestamp( $cutoff_unixtime );
299 $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
300 if( $fromValid && $opts['from'] > wfTimestamp( TS_MW
, $cutoff ) ) {
301 $cutoff = $dbr->timestamp( $opts['from'] );
303 $opts->reset( 'from' );
306 $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
308 $hidePatrol = $this->getUser()->useRCPatrol() && $opts['hidepatrolled'];
309 $hideLoggedInUsers = $opts['hideliu'] && !$forcebot;
310 $hideAnonymousUsers = $opts['hideanons'] && !$forcebot;
312 if( $opts['hideminor'] ) {
313 $conds['rc_minor'] = 0;
315 if( $opts['hidebots'] ) {
316 $conds['rc_bot'] = 0;
319 $conds['rc_patrolled'] = 0;
322 $conds['rc_bot'] = 1;
324 if( $hideLoggedInUsers ) {
325 $conds[] = 'rc_user = 0';
327 if( $hideAnonymousUsers ) {
328 $conds[] = 'rc_user != 0';
331 if( $opts['hidemyself'] ) {
332 if( $this->getUser()->getId() ) {
333 $conds[] = 'rc_user != ' . $dbr->addQuotes( $this->getUser()->getId() );
335 $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $this->getUser()->getName() );
339 # Namespace filtering
340 if( $opts['namespace'] !== '' ) {
341 $selectedNS = $dbr->addQuotes( $opts['namespace'] );
342 $operator = $opts['invert'] ?
'!=' : '=';
343 $boolean = $opts['invert'] ?
'AND' : 'OR';
345 # namespace association (bug 2429)
346 if( !$opts['associated'] ) {
347 $condition = "rc_namespace $operator $selectedNS";
349 # Also add the associated namespace
350 $associatedNS = $dbr->addQuotes(
351 MWNamespace
::getAssociated( $opts['namespace'] )
353 $condition = "(rc_namespace $operator $selectedNS "
355 . " rc_namespace $operator $associatedNS)";
358 $conds[] = $condition;
366 * @param $conds Array
367 * @param $opts FormOptions
368 * @return bool|ResultWrapper result or false (for Recentchangeslinked only)
370 public function doMainQuery( $conds, $opts ) {
371 $tables = array( 'recentchanges' );
372 $join_conds = array();
373 $query_options = array(
374 'USE INDEX' => array( 'recentchanges' => 'rc_timestamp' )
377 $uid = $this->getUser()->getId();
378 $dbr = wfGetDB( DB_SLAVE
);
379 $limit = $opts['limit'];
380 $namespace = $opts['namespace'];
381 $invert = $opts['invert'];
382 $associated = $opts['associated'];
384 $fields = RecentChange
::selectFields();
385 // JOIN on watchlist for users
387 $tables[] = 'watchlist';
388 $fields[] = 'wl_user';
389 $fields[] = 'wl_notificationtimestamp';
390 $join_conds['watchlist'] = array( 'LEFT JOIN', array(
393 'wl_namespace=rc_namespace'
396 if ( $this->getUser()->isAllowed( 'rollback' ) ) {
398 $fields[] = 'page_latest';
399 $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
402 ChangeTags
::modifyDisplayQuery(
411 if ( !wfRunHooks( 'SpecialRecentChangesQuery',
412 array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ) ) )
417 // Don't use the new_namespace_time timestamp index if:
418 // (a) "All namespaces" selected
419 // (b) We want pages in more than one namespace (inverted/associated)
420 // (c) There is a tag to filter on (use tag index instead)
421 // (d) UNION + sort/limit is not an option for the DBMS
422 if( $namespace === ''
423 ||
( $invert ||
$associated )
424 ||
$opts['tagfilter'] != ''
425 ||
!$dbr->unionSupportsOrderAndLimit() )
427 $res = $dbr->select( $tables, $fields, $conds, __METHOD__
,
428 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) +
431 // We have a new_namespace_time index! UNION over new=(0,1) and sort result set!
434 $sqlNew = $dbr->selectSQLText(
437 array( 'rc_new' => 1 ) +
$conds,
440 'ORDER BY' => 'rc_timestamp DESC',
442 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' )
447 $sqlOld = $dbr->selectSQLText(
450 array( 'rc_new' => 0 ) +
$conds,
453 'ORDER BY' => 'rc_timestamp DESC',
455 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' )
459 # Join the two fast queries, and sort the result set
460 $sql = $dbr->unionQueries( array( $sqlNew, $sqlOld ), false ) .
461 ' ORDER BY rc_timestamp DESC';
462 $sql = $dbr->limitResult( $sql, $limit, false );
463 $res = $dbr->query( $sql, __METHOD__
);
470 * Send output to the OutputPage object, only called if not used feeds
472 * @param $rows Array of database rows
473 * @param $opts FormOptions
475 public function webOutput( $rows, $opts ) {
476 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker, $wgAllowCategorizedRecentChanges;
478 $limit = $opts['limit'];
480 if( !$this->including() ) {
481 // Output options box
482 $this->doHeader( $opts );
485 // And now for the content
486 $feedQuery = $this->getFeedQuery();
487 if ( $feedQuery !== '' ) {
488 $this->getOutput()->setFeedAppendQuery( $feedQuery );
490 $this->getOutput()->setFeedAppendQuery( false );
493 if( $wgAllowCategorizedRecentChanges ) {
494 $this->filterByCategories( $rows, $opts );
497 $showWatcherCount = $wgRCShowWatchingUsers && $this->getUser()->getOption( 'shownumberswatching' );
498 $watcherCache = array();
500 $dbr = wfGetDB( DB_SLAVE
);
503 $list = ChangesList
::newFromContext( $this->getContext() );
505 $s = $list->beginRecentChangesList();
506 foreach( $rows as $obj ) {
510 $rc = RecentChange
::newFromRow( $obj );
511 $rc->counter
= $counter++
;
512 # Check if the page has been updated since the last visit
513 if( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp
) ) {
514 $rc->notificationtimestamp
= ( $obj->rc_timestamp
>= $obj->wl_notificationtimestamp
);
516 $rc->notificationtimestamp
= false; // Default
518 # Check the number of users watching the page
519 $rc->numberofWatchingusers
= 0; // Default
520 if( $showWatcherCount && $obj->rc_namespace
>= 0 ) {
521 if( !isset( $watcherCache[$obj->rc_namespace
][$obj->rc_title
] ) ) {
522 $watcherCache[$obj->rc_namespace
][$obj->rc_title
] =
527 'wl_namespace' => $obj->rc_namespace
,
528 'wl_title' => $obj->rc_title
,
530 __METHOD__
. '-watchers'
533 $rc->numberofWatchingusers
= $watcherCache[$obj->rc_namespace
][$obj->rc_title
];
536 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user
), $counter );
537 if ( $changeLine !== false ) {
542 $s .= $list->endRecentChangesList();
543 $this->getOutput()->addHTML( $s );
547 * Get the query string to append to feed link URLs.
551 public function getFeedQuery() {
554 $this->getOptions()->validateIntBounds( 'limit', 0, $wgFeedLimit );
555 $options = $this->getOptions()->getChangedValues();
557 // wfArrayToCgi() omits options set to null or false
558 foreach ( $options as &$value ) {
559 if ( $value === false ) {
565 return wfArrayToCgi( $options );
569 * Return the text to be displayed above the changes
571 * @param $opts FormOptions
572 * @return String: XHTML
574 public function doHeader( $opts ) {
577 $this->setTopText( $opts );
579 $defaults = $opts->getAllValues();
580 $nondefaults = $opts->getChangedValues();
581 $opts->consumeValues( array(
582 'namespace', 'invert', 'associated', 'tagfilter',
583 'categories', 'categories_any'
587 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
590 $extraOpts = $this->getExtraOptions( $opts );
591 $extraOptsCount = count( $extraOpts );
593 $submit = ' ' . Xml
::submitbutton( $this->msg( 'allpagessubmit' )->text() );
595 $out = Xml
::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
596 foreach( $extraOpts as $name => $optionRow ) {
597 # Add submit button to the last row only
599 $addSubmit = ( $count === $extraOptsCount ) ?
$submit : '';
601 $out .= Xml
::openElement( 'tr' );
602 if( is_array( $optionRow ) ) {
603 $out .= Xml
::tags( 'td', array( 'class' => 'mw-label mw-' . $name . '-label' ), $optionRow[0] );
604 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
606 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ), $optionRow . $addSubmit );
608 $out .= Xml
::closeElement( 'tr' );
610 $out .= Xml
::closeElement( 'table' );
612 $unconsumed = $opts->getUnconsumedValues();
613 foreach( $unconsumed as $key => $value ) {
614 $out .= Html
::hidden( $key, $value );
617 $t = $this->getTitle();
618 $out .= Html
::hidden( 'title', $t->getPrefixedText() );
619 $form = Xml
::tags( 'form', array( 'action' => $wgScript ), $out );
621 $panelString = implode( "\n", $panel );
623 $this->getOutput()->addHTML(
624 Xml
::fieldset( $this->msg( 'recentchanges-legend' )->text(), $panelString, array( 'class' => 'rcoptions' ) )
627 $this->setBottomText( $opts );
631 * Get options to be displayed in a form
633 * @param $opts FormOptions
636 function getExtraOptions( $opts ) {
637 $extraOpts = array();
638 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
640 global $wgAllowCategorizedRecentChanges;
641 if( $wgAllowCategorizedRecentChanges ) {
642 $extraOpts['category'] = $this->categoryFilterForm( $opts );
645 $tagFilter = ChangeTags
::buildTagFilterSelector( $opts['tagfilter'] );
646 if ( count( $tagFilter ) ) {
647 $extraOpts['tagfilter'] = $tagFilter;
650 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
655 * Send the text to be displayed above the options
657 * @param $opts FormOptions
659 function setTopText( FormOptions
$opts ) {
662 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
663 if ( !$message->isDisabled() ) {
664 $this->getOutput()->addWikiText(
665 Html
::rawElement( 'p',
666 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
667 "\n" . $message->plain() . "\n"
669 /* $lineStart */ false,
670 /* $interface */ false
676 * Send the text to be displayed after the options, for use in
677 * Recentchangeslinked
679 * @param $opts FormOptions
681 function setBottomText( FormOptions
$opts ) {}
684 * Creates the choose namespace selection
686 * @todo Uses radio buttons (HASHAR)
687 * @param $opts FormOptions
690 protected function namespaceFilterForm( FormOptions
$opts ) {
691 $nsSelect = Html
::namespaceSelector(
692 array( 'selected' => $opts['namespace'], 'all' => '' ),
693 array( 'name' => 'namespace', 'id' => 'namespace' )
695 $nsLabel = Xml
::label( $this->msg( 'namespace' )->text(), 'namespace' );
696 $invert = Xml
::checkLabel(
697 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
699 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
701 $associated = Xml
::checkLabel(
702 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
704 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
706 return array( $nsLabel, "$nsSelect $invert $associated" );
710 * Create a input to filter changes by categories
712 * @param $opts FormOptions
715 protected function categoryFilterForm( FormOptions
$opts ) {
716 list( $label, $input ) = Xml
::inputLabelSep( $this->msg( 'rc_categories' )->text(),
717 'categories', 'mw-categories', false, $opts['categories'] );
719 $input .= ' ' . Xml
::checkLabel( $this->msg( 'rc_categories_any' )->text(),
720 'categories_any', 'mw-categories_any', $opts['categories_any'] );
722 return array( $label, $input );
726 * Filter $rows by categories set in $opts
728 * @param $rows Array of database rows
729 * @param $opts FormOptions
731 function filterByCategories( &$rows, FormOptions
$opts ) {
732 $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
734 if( !count( $categories ) ) {
740 foreach( $categories as $cat ) {
752 foreach( $rows as $k => $r ) {
753 $nt = Title
::makeTitle( $r->rc_namespace
, $r->rc_title
);
754 $id = $nt->getArticleID();
756 continue; # Page might have been deleted...
758 if( !in_array( $id, $articles ) ) {
761 if( !isset( $a2r[$id] ) ) {
769 if( !count( $articles ) ||
!count( $cats ) ) {
774 $c = new Categoryfinder
;
775 $c->seed( $articles, $cats, $opts['categories_any'] ?
'OR' : 'AND' );
780 foreach( $match as $id ) {
781 foreach( $a2r[$id] as $rev ) {
783 $newrows[$k] = $rowsarr[$k];
790 * Makes change an option link which carries all the other options
792 * @param $title Title
793 * @param $override Array: options to override
794 * @param $options Array: current options
795 * @param $active Boolean: whether to show the link in bold
798 function makeOptionsLink( $title, $override, $options, $active = false ) {
799 $params = $override +
$options;
801 // Bug 36524: false values have be converted to "0" otherwise
802 // wfArrayToCgi() will omit it them.
803 foreach ( $params as &$value ) {
804 if ( $value === false ) {
810 $text = htmlspecialchars( $title );
812 $text = '<strong>' . $text . '</strong>';
814 return Linker
::linkKnown( $this->getTitle(), $text, array(), $params );
818 * Creates the options panel.
820 * @param $defaults Array
821 * @param $nondefaults Array
824 function optionsPanel( $defaults, $nondefaults ) {
825 global $wgRCLinkLimits, $wgRCLinkDays;
827 $options = $nondefaults +
$defaults;
830 $msg = $this->msg( 'rclegend' );
831 if( !$msg->isDisabled() ) {
832 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
835 $lang = $this->getLanguage();
836 $user = $this->getUser();
837 if( $options['from'] ) {
838 $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
839 $lang->userTimeAndDate( $options['from'], $user ),
840 $lang->userDate( $options['from'], $user ),
841 $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
844 # Sort data for display and make sure it's unique after we've added user data.
845 $wgRCLinkLimits[] = $options['limit'];
846 $wgRCLinkDays[] = $options['days'];
847 sort( $wgRCLinkLimits );
848 sort( $wgRCLinkDays );
849 $wgRCLinkLimits = array_unique( $wgRCLinkLimits );
850 $wgRCLinkDays = array_unique( $wgRCLinkDays );
853 foreach( $wgRCLinkLimits as $value ) {
854 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
855 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
857 $cl = $lang->pipeList( $cl );
859 // day links, reset 'from' to none
860 foreach( $wgRCLinkDays as $value ) {
861 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
862 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
864 $dl = $lang->pipeList( $dl );
868 $showhide = array( $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() );
870 'hideminor' => 'rcshowhideminor',
871 'hidebots' => 'rcshowhidebots',
872 'hideanons' => 'rcshowhideanons',
873 'hideliu' => 'rcshowhideliu',
874 'hidepatrolled' => 'rcshowhidepatr',
875 'hidemyself' => 'rcshowhidemine'
877 foreach ( $this->getCustomFilters() as $key => $params ) {
878 $filters[$key] = $params['msg'];
880 // Disable some if needed
881 if ( !$user->useRCPatrol() ) {
882 unset( $filters['hidepatrolled'] );
886 foreach ( $filters as $key => $msg ) {
887 $link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
888 array( $key => 1-$options[$key] ), $nondefaults );
889 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
892 // show from this onward link
893 $timestamp = wfTimestampNow();
894 $now = $lang->userTimeAndDate( $timestamp, $user );
895 $tl = $this->makeOptionsLink(
896 $now, array( 'from' => $timestamp ), $nondefaults
899 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )->parse();
900 $rclistfrom = $this->msg( 'rclistfrom' )->rawParams( $tl )->parse();
901 return "{$note}$rclinks<br />$rclistfrom";
905 * add javascript specific to the [[Special:RecentChanges]] page
907 function addRecentChangesJS() {
908 $this->getOutput()->addModules( array(
909 'mediawiki.special.recentchanges',