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', $this->getUser()->getIntOption( 'rcdays' ) );
46 $opts->add( 'limit', $this->getUser()->getIntOption( '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
;
133 * Main execution point
135 * @param $subpage String
137 public function execute( $subpage ) {
138 $this->rcSubpage
= $subpage;
139 $feedFormat = $this->including() ?
null : $this->getRequest()->getVal( 'feed' );
141 # 10 seconds server-side caching max
142 $this->getOutput()->setSquidMaxage( 10 );
143 # Check if the client has a cached version
144 $lastmod = $this->checkLastModified( $feedFormat );
145 if( $lastmod === false ) {
149 $opts = $this->getOptions();
151 $this->outputHeader();
152 $this->addRecentChangesJS();
154 // Fetch results, prepare a batch link existence check query
155 $conds = $this->buildMainQueryConds( $opts );
156 $rows = $this->doMainQuery( $conds, $opts );
157 if( $rows === false ) {
158 if( !$this->including() ) {
159 $this->doHeader( $opts );
165 $batch = new LinkBatch
;
166 foreach( $rows as $row ) {
167 $batch->add( NS_USER
, $row->rc_user_text
);
168 $batch->add( NS_USER_TALK
, $row->rc_user_text
);
169 $batch->add( $row->rc_namespace
, $row->rc_title
);
174 list( $changesFeed, $formatter ) = $this->getFeedObject( $feedFormat );
175 $changesFeed->execute( $formatter, $rows, $lastmod, $opts );
177 $this->webOutput( $rows, $opts );
184 * Return an array with a ChangesFeed object and ChannelFeed object
188 public function getFeedObject( $feedFormat ) {
189 $changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
190 $formatter = $changesFeed->getFeedObject(
191 $this->msg( 'recentchanges' )->inContentLanguage()->text(),
192 $this->msg( 'recentchanges-feed-description' )->inContentLanguage()->text(),
193 $this->getTitle()->getFullURL()
195 return array( $changesFeed, $formatter );
199 * Process $par and put options found if $opts
200 * Mainly used when including the page
203 * @param $opts FormOptions
205 public function parseParameters( $par, FormOptions
$opts ) {
206 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
207 foreach( $bits as $bit ) {
208 if( 'hidebots' === $bit ) {
209 $opts['hidebots'] = true;
211 if( 'bots' === $bit ) {
212 $opts['hidebots'] = false;
214 if( 'hideminor' === $bit ) {
215 $opts['hideminor'] = true;
217 if( 'minor' === $bit ) {
218 $opts['hideminor'] = false;
220 if( 'hideliu' === $bit ) {
221 $opts['hideliu'] = true;
223 if( 'hidepatrolled' === $bit ) {
224 $opts['hidepatrolled'] = true;
226 if( 'hideanons' === $bit ) {
227 $opts['hideanons'] = true;
229 if( 'hidemyself' === $bit ) {
230 $opts['hidemyself'] = true;
233 if( is_numeric( $bit ) ) {
234 $opts['limit'] = $bit;
238 if( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
239 $opts['limit'] = $m[1];
241 if( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
242 $opts['days'] = $m[1];
244 if( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
245 $opts['namespace'] = $m[1];
251 * Get last modified date, for client caching
252 * Don't use this if we are using the patrol feature, patrol changes don't
253 * update the timestamp
255 * @param $feedFormat String
256 * @return String or false
258 public function checkLastModified( $feedFormat ) {
259 $dbr = wfGetDB( DB_SLAVE
);
260 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__
);
261 if( $feedFormat ||
!$this->getUser()->useRCPatrol() ) {
262 if( $lastmod && $this->getOutput()->checkLastModified( $lastmod ) ) {
263 # Client cache fresh and headers sent, nothing more to do.
271 * Return an array of conditions depending of options set in $opts
273 * @param $opts FormOptions
276 public function buildMainQueryConds( FormOptions
$opts ) {
277 $dbr = wfGetDB( DB_SLAVE
);
280 # It makes no sense to hide both anons and logged-in users
281 # Where this occurs, force anons to be shown
283 if( $opts['hideanons'] && $opts['hideliu'] ) {
284 # Check if the user wants to show bots only
285 if( $opts['hidebots'] ) {
286 $opts['hideanons'] = false;
289 $opts['hidebots'] = false;
294 $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
295 $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime %
86400);
296 $cutoff = $dbr->timestamp( $cutoff_unixtime );
298 $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
299 if( $fromValid && $opts['from'] > wfTimestamp( TS_MW
, $cutoff ) ) {
300 $cutoff = $dbr->timestamp( $opts['from'] );
302 $opts->reset( 'from' );
305 $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
307 $hidePatrol = $this->getUser()->useRCPatrol() && $opts['hidepatrolled'];
308 $hideLoggedInUsers = $opts['hideliu'] && !$forcebot;
309 $hideAnonymousUsers = $opts['hideanons'] && !$forcebot;
311 if( $opts['hideminor'] ) {
312 $conds['rc_minor'] = 0;
314 if( $opts['hidebots'] ) {
315 $conds['rc_bot'] = 0;
318 $conds['rc_patrolled'] = 0;
321 $conds['rc_bot'] = 1;
323 if( $hideLoggedInUsers ) {
324 $conds[] = 'rc_user = 0';
326 if( $hideAnonymousUsers ) {
327 $conds[] = 'rc_user != 0';
330 if( $opts['hidemyself'] ) {
331 if( $this->getUser()->getId() ) {
332 $conds[] = 'rc_user != ' . $dbr->addQuotes( $this->getUser()->getId() );
334 $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $this->getUser()->getName() );
338 # Namespace filtering
339 if( $opts['namespace'] !== '' ) {
340 $selectedNS = $dbr->addQuotes( $opts['namespace'] );
341 $operator = $opts['invert'] ?
'!=' : '=';
342 $boolean = $opts['invert'] ?
'AND' : 'OR';
344 # namespace association (bug 2429)
345 if( !$opts['associated'] ) {
346 $condition = "rc_namespace $operator $selectedNS";
348 # Also add the associated namespace
349 $associatedNS = $dbr->addQuotes(
350 MWNamespace
::getAssociated( $opts['namespace'] )
352 $condition = "(rc_namespace $operator $selectedNS "
354 . " rc_namespace $operator $associatedNS)";
357 $conds[] = $condition;
365 * @param $conds Array
366 * @param $opts FormOptions
367 * @return bool|ResultWrapper result or false (for Recentchangeslinked only)
369 public function doMainQuery( $conds, $opts ) {
370 $tables = array( 'recentchanges' );
371 $join_conds = array();
372 $query_options = array(
373 'USE INDEX' => array( 'recentchanges' => 'rc_timestamp' )
376 $uid = $this->getUser()->getId();
377 $dbr = wfGetDB( DB_SLAVE
);
378 $limit = $opts['limit'];
379 $namespace = $opts['namespace'];
380 $invert = $opts['invert'];
381 $associated = $opts['associated'];
383 $fields = RecentChange
::selectFields();
384 // JOIN on watchlist for users
386 $tables[] = 'watchlist';
387 $fields[] = 'wl_user';
388 $fields[] = 'wl_notificationtimestamp';
389 $join_conds['watchlist'] = array( 'LEFT JOIN', array(
392 'wl_namespace=rc_namespace'
395 if ( $this->getUser()->isAllowed( 'rollback' ) ) {
397 $fields[] = 'page_latest';
398 $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
401 ChangeTags
::modifyDisplayQuery(
410 if ( !wfRunHooks( 'SpecialRecentChangesQuery',
411 array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ) ) )
416 // Don't use the new_namespace_time timestamp index if:
417 // (a) "All namespaces" selected
418 // (b) We want pages in more than one namespace (inverted/associated)
419 // (c) There is a tag to filter on (use tag index instead)
420 // (d) UNION + sort/limit is not an option for the DBMS
421 if( $namespace === ''
422 ||
( $invert ||
$associated )
423 ||
$opts['tagfilter'] != ''
424 ||
!$dbr->unionSupportsOrderAndLimit() )
426 $res = $dbr->select( $tables, $fields, $conds, __METHOD__
,
427 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) +
430 // We have a new_namespace_time index! UNION over new=(0,1) and sort result set!
433 $sqlNew = $dbr->selectSQLText(
436 array( 'rc_new' => 1 ) +
$conds,
439 'ORDER BY' => 'rc_timestamp DESC',
441 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' )
446 $sqlOld = $dbr->selectSQLText(
449 array( 'rc_new' => 0 ) +
$conds,
452 'ORDER BY' => 'rc_timestamp DESC',
454 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' )
458 # Join the two fast queries, and sort the result set
459 $sql = $dbr->unionQueries( array( $sqlNew, $sqlOld ), false ) .
460 ' ORDER BY rc_timestamp DESC';
461 $sql = $dbr->limitResult( $sql, $limit, false );
462 $res = $dbr->query( $sql, __METHOD__
);
469 * Send output to the OutputPage object, only called if not used feeds
471 * @param $rows Array of database rows
472 * @param $opts FormOptions
474 public function webOutput( $rows, $opts ) {
475 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker, $wgAllowCategorizedRecentChanges;
477 $limit = $opts['limit'];
479 if( !$this->including() ) {
480 // Output options box
481 $this->doHeader( $opts );
484 // And now for the content
485 $feedQuery = $this->getFeedQuery();
486 if ( $feedQuery !== '' ) {
487 $this->getOutput()->setFeedAppendQuery( $feedQuery );
489 $this->getOutput()->setFeedAppendQuery( false );
492 if( $wgAllowCategorizedRecentChanges ) {
493 $this->filterByCategories( $rows, $opts );
496 $showWatcherCount = $wgRCShowWatchingUsers && $this->getUser()->getOption( 'shownumberswatching' );
497 $watcherCache = array();
499 $dbr = wfGetDB( DB_SLAVE
);
502 $list = ChangesList
::newFromContext( $this->getContext() );
504 $s = $list->beginRecentChangesList();
505 foreach( $rows as $obj ) {
509 $rc = RecentChange
::newFromRow( $obj );
510 $rc->counter
= $counter++
;
511 # Check if the page has been updated since the last visit
512 if( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp
) ) {
513 $rc->notificationtimestamp
= ( $obj->rc_timestamp
>= $obj->wl_notificationtimestamp
);
515 $rc->notificationtimestamp
= false; // Default
517 # Check the number of users watching the page
518 $rc->numberofWatchingusers
= 0; // Default
519 if( $showWatcherCount && $obj->rc_namespace
>= 0 ) {
520 if( !isset( $watcherCache[$obj->rc_namespace
][$obj->rc_title
] ) ) {
521 $watcherCache[$obj->rc_namespace
][$obj->rc_title
] =
526 'wl_namespace' => $obj->rc_namespace
,
527 'wl_title' => $obj->rc_title
,
529 __METHOD__
. '-watchers'
532 $rc->numberofWatchingusers
= $watcherCache[$obj->rc_namespace
][$obj->rc_title
];
535 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user
), $counter );
536 if ( $changeLine !== false ) {
541 $s .= $list->endRecentChangesList();
542 $this->getOutput()->addHTML( $s );
546 * Get the query string to append to feed link URLs.
550 public function getFeedQuery() {
553 $this->getOptions()->validateIntBounds( 'limit', 0, $wgFeedLimit );
554 $options = $this->getOptions()->getChangedValues();
556 // wfArrayToCgi() omits options set to null or false
557 foreach ( $options as &$value ) {
558 if ( $value === false ) {
564 return wfArrayToCgi( $options );
568 * Return the text to be displayed above the changes
570 * @param $opts FormOptions
571 * @return String: XHTML
573 public function doHeader( $opts ) {
576 $this->setTopText( $opts );
578 $defaults = $opts->getAllValues();
579 $nondefaults = $opts->getChangedValues();
580 $opts->consumeValues( array(
581 'namespace', 'invert', 'associated', 'tagfilter',
582 'categories', 'categories_any'
586 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
589 $extraOpts = $this->getExtraOptions( $opts );
590 $extraOptsCount = count( $extraOpts );
592 $submit = ' ' . Xml
::submitbutton( $this->msg( 'allpagessubmit' )->text() );
594 $out = Xml
::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
595 foreach( $extraOpts as $name => $optionRow ) {
596 # Add submit button to the last row only
598 $addSubmit = ( $count === $extraOptsCount ) ?
$submit : '';
600 $out .= Xml
::openElement( 'tr' );
601 if( is_array( $optionRow ) ) {
602 $out .= Xml
::tags( 'td', array( 'class' => 'mw-label mw-' . $name . '-label' ), $optionRow[0] );
603 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
605 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ), $optionRow . $addSubmit );
607 $out .= Xml
::closeElement( 'tr' );
609 $out .= Xml
::closeElement( 'table' );
611 $unconsumed = $opts->getUnconsumedValues();
612 foreach( $unconsumed as $key => $value ) {
613 $out .= Html
::hidden( $key, $value );
616 $t = $this->getTitle();
617 $out .= Html
::hidden( 'title', $t->getPrefixedText() );
618 $form = Xml
::tags( 'form', array( 'action' => $wgScript ), $out );
620 $panelString = implode( "\n", $panel );
622 $this->getOutput()->addHTML(
623 Xml
::fieldset( $this->msg( 'recentchanges-legend' )->text(), $panelString, array( 'class' => 'rcoptions' ) )
626 $this->setBottomText( $opts );
630 * Get options to be displayed in a form
632 * @param $opts FormOptions
635 function getExtraOptions( $opts ) {
636 $extraOpts = array();
637 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
639 global $wgAllowCategorizedRecentChanges;
640 if( $wgAllowCategorizedRecentChanges ) {
641 $extraOpts['category'] = $this->categoryFilterForm( $opts );
644 $tagFilter = ChangeTags
::buildTagFilterSelector( $opts['tagfilter'] );
645 if ( count( $tagFilter ) ) {
646 $extraOpts['tagfilter'] = $tagFilter;
649 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
654 * Send the text to be displayed above the options
656 * @param $opts FormOptions
658 function setTopText( FormOptions
$opts ) {
661 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
662 if ( !$message->isDisabled() ) {
663 $this->getOutput()->addWikiText(
664 Html
::rawElement( 'p',
665 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
666 "\n" . $message->plain() . "\n"
668 /* $lineStart */ false,
669 /* $interface */ false
675 * Send the text to be displayed after the options, for use in
676 * Recentchangeslinked
678 * @param $opts FormOptions
680 function setBottomText( FormOptions
$opts ) {}
683 * Creates the choose namespace selection
685 * @todo Uses radio buttons (HASHAR)
686 * @param $opts FormOptions
689 protected function namespaceFilterForm( FormOptions
$opts ) {
690 $nsSelect = Html
::namespaceSelector(
691 array( 'selected' => $opts['namespace'], 'all' => '' ),
692 array( 'name' => 'namespace', 'id' => 'namespace' )
694 $nsLabel = Xml
::label( $this->msg( 'namespace' )->text(), 'namespace' );
695 $invert = Xml
::checkLabel(
696 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
698 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
700 $associated = Xml
::checkLabel(
701 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
703 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
705 return array( $nsLabel, "$nsSelect $invert $associated" );
709 * Create a input to filter changes by categories
711 * @param $opts FormOptions
714 protected function categoryFilterForm( FormOptions
$opts ) {
715 list( $label, $input ) = Xml
::inputLabelSep( $this->msg( 'rc_categories' )->text(),
716 'categories', 'mw-categories', false, $opts['categories'] );
718 $input .= ' ' . Xml
::checkLabel( $this->msg( 'rc_categories_any' )->text(),
719 'categories_any', 'mw-categories_any', $opts['categories_any'] );
721 return array( $label, $input );
725 * Filter $rows by categories set in $opts
727 * @param $rows Array of database rows
728 * @param $opts FormOptions
730 function filterByCategories( &$rows, FormOptions
$opts ) {
731 $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
733 if( !count( $categories ) ) {
739 foreach( $categories as $cat ) {
751 foreach( $rows as $k => $r ) {
752 $nt = Title
::makeTitle( $r->rc_namespace
, $r->rc_title
);
753 $id = $nt->getArticleID();
755 continue; # Page might have been deleted...
757 if( !in_array( $id, $articles ) ) {
760 if( !isset( $a2r[$id] ) ) {
768 if( !count( $articles ) ||
!count( $cats ) ) {
773 $c = new Categoryfinder
;
774 $c->seed( $articles, $cats, $opts['categories_any'] ?
'OR' : 'AND' );
779 foreach( $match as $id ) {
780 foreach( $a2r[$id] as $rev ) {
782 $newrows[$k] = $rowsarr[$k];
789 * Makes change an option link which carries all the other options
791 * @param $title Title
792 * @param $override Array: options to override
793 * @param $options Array: current options
794 * @param $active Boolean: whether to show the link in bold
797 function makeOptionsLink( $title, $override, $options, $active = false ) {
798 $params = $override +
$options;
800 // Bug 36524: false values have be converted to "0" otherwise
801 // wfArrayToCgi() will omit it them.
802 foreach ( $params as &$value ) {
803 if ( $value === false ) {
809 $text = htmlspecialchars( $title );
811 $text = '<strong>' . $text . '</strong>';
813 return Linker
::linkKnown( $this->getTitle(), $text, array(), $params );
817 * Creates the options panel.
819 * @param $defaults Array
820 * @param $nondefaults Array
823 function optionsPanel( $defaults, $nondefaults ) {
824 global $wgRCLinkLimits, $wgRCLinkDays;
826 $options = $nondefaults +
$defaults;
829 $msg = $this->msg( 'rclegend' );
830 if( !$msg->isDisabled() ) {
831 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
834 $lang = $this->getLanguage();
835 $user = $this->getUser();
836 if( $options['from'] ) {
837 $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
838 $lang->userTimeAndDate( $options['from'], $user ),
839 $lang->userDate( $options['from'], $user ),
840 $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
843 # Sort data for display and make sure it's unique after we've added user data.
844 $wgRCLinkLimits[] = $options['limit'];
845 $wgRCLinkDays[] = $options['days'];
846 sort( $wgRCLinkLimits );
847 sort( $wgRCLinkDays );
848 $wgRCLinkLimits = array_unique( $wgRCLinkLimits );
849 $wgRCLinkDays = array_unique( $wgRCLinkDays );
852 foreach( $wgRCLinkLimits as $value ) {
853 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
854 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
856 $cl = $lang->pipeList( $cl );
858 // day links, reset 'from' to none
859 foreach( $wgRCLinkDays as $value ) {
860 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
861 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
863 $dl = $lang->pipeList( $dl );
866 $showhide = array( $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() );
868 'hideminor' => 'rcshowhideminor',
869 'hidebots' => 'rcshowhidebots',
870 'hideanons' => 'rcshowhideanons',
871 'hideliu' => 'rcshowhideliu',
872 'hidepatrolled' => 'rcshowhidepatr',
873 'hidemyself' => 'rcshowhidemine'
875 foreach ( $this->getCustomFilters() as $key => $params ) {
876 $filters[$key] = $params['msg'];
878 // Disable some if needed
879 if ( !$user->useRCPatrol() ) {
880 unset( $filters['hidepatrolled'] );
884 foreach ( $filters as $key => $msg ) {
885 $link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
886 array( $key => 1-$options[$key] ), $nondefaults );
887 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
890 // show from this onward link
891 $timestamp = wfTimestampNow();
892 $now = $lang->userTimeAndDate( $timestamp, $user );
893 $tl = $this->makeOptionsLink(
894 $now, array( 'from' => $timestamp ), $nondefaults
897 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )->parse();
898 $rclistfrom = $this->msg( 'rclistfrom' )->rawParams( $tl )->parse();
899 return "{$note}$rclinks<br />$rclistfrom";
903 * add javascript specific to the [[Special:RecentChanges]] page
905 function addRecentChangesJS() {
906 $this->getOutput()->addModules( array(
907 'mediawiki.special.recentchanges',
911 protected function getGroupName() {