f770307801ff7c621d9c759cde9879dd4461d0b2
[lhc/web/wiklou.git] / includes / specials / SpecialRecentchanges.php
1 <?php
2 /**
3 * Implements Special:Recentchanges
4 *
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.
9 *
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.
14 *
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
19 *
20 * @file
21 * @ingroup SpecialPage
22 */
23
24 /**
25 * A special page that lists last changes made to the wiki
26 *
27 * @ingroup SpecialPage
28 */
29 class SpecialRecentChanges extends ChangesListSpecialPage {
30 // @codingStandardsIgnoreStart Needed "useless" override to change parameters.
31 public function __construct( $name = 'Recentchanges', $restriction = '' ) {
32 parent::__construct( $name, $restriction );
33 }
34 // @codingStandardsIgnoreEnd
35
36 /**
37 * Main execution point
38 *
39 * @param string $subpage
40 */
41 public function execute( $subpage ) {
42 // Backwards-compatibility: redirect to new feed URLs
43 $feedFormat = $this->getRequest()->getVal( 'feed' );
44 if ( !$this->including() && $feedFormat ) {
45 $query = $this->getFeedQuery();
46 $query['feedformat'] = $feedFormat === 'atom' ? 'atom' : 'rss';
47 $this->getOutput()->redirect( wfAppendQuery( wfScript( 'api' ), $query ) );
48
49 return;
50 }
51
52 // 10 seconds server-side caching max
53 $this->getOutput()->setSquidMaxage( 10 );
54 // Check if the client has a cached version
55 $lastmod = $this->checkLastModified();
56 if ( $lastmod === false ) {
57 return;
58 }
59
60 parent::execute( $subpage );
61 }
62
63 /**
64 * Get a FormOptions object containing the default options
65 *
66 * @return FormOptions
67 */
68 public function getDefaultOptions() {
69 $opts = parent::getDefaultOptions();
70 $user = $this->getUser();
71
72 $opts->add( 'days', $user->getIntOption( 'rcdays' ) );
73 $opts->add( 'limit', $user->getIntOption( 'rclimit' ) );
74 $opts->add( 'from', '' );
75
76 $opts->add( 'hideminor', $user->getBoolOption( 'hideminor' ) );
77 $opts->add( 'hidebots', true );
78 $opts->add( 'hideanons', false );
79 $opts->add( 'hideliu', false );
80 $opts->add( 'hidepatrolled', $user->getBoolOption( 'hidepatrolled' ) );
81 $opts->add( 'hidemyself', false );
82
83 $opts->add( 'categories', '' );
84 $opts->add( 'categories_any', false );
85 $opts->add( 'tagfilter', '' );
86
87 return $opts;
88 }
89
90 /**
91 * Get custom show/hide filters
92 *
93 * @return array Map of filter URL param names to properties (msg/default)
94 */
95 protected function getCustomFilters() {
96 if ( $this->customFilters === null ) {
97 $this->customFilters = parent::getCustomFilters();
98 wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ), '1.23' );
99 }
100
101 return $this->customFilters;
102 }
103
104 /**
105 * Process $par and put options found in $opts. Used when including the page.
106 *
107 * @param string $par
108 * @param FormOptions $opts
109 */
110 public function parseParameters( $par, FormOptions $opts ) {
111 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
112 foreach ( $bits as $bit ) {
113 if ( 'hidebots' === $bit ) {
114 $opts['hidebots'] = true;
115 }
116 if ( 'bots' === $bit ) {
117 $opts['hidebots'] = false;
118 }
119 if ( 'hideminor' === $bit ) {
120 $opts['hideminor'] = true;
121 }
122 if ( 'minor' === $bit ) {
123 $opts['hideminor'] = false;
124 }
125 if ( 'hideliu' === $bit ) {
126 $opts['hideliu'] = true;
127 }
128 if ( 'hidepatrolled' === $bit ) {
129 $opts['hidepatrolled'] = true;
130 }
131 if ( 'hideanons' === $bit ) {
132 $opts['hideanons'] = true;
133 }
134 if ( 'hidemyself' === $bit ) {
135 $opts['hidemyself'] = true;
136 }
137
138 if ( is_numeric( $bit ) ) {
139 $opts['limit'] = $bit;
140 }
141
142 $m = array();
143 if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
144 $opts['limit'] = $m[1];
145 }
146 if ( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
147 $opts['days'] = $m[1];
148 }
149 if ( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
150 $opts['namespace'] = $m[1];
151 }
152 }
153 }
154
155 public function validateOptions( FormOptions $opts ) {
156 $opts->validateIntBounds( 'limit', 0, 5000 );
157 parent::validateOptions( $opts );
158 }
159
160 /**
161 * Return an array of conditions depending of options set in $opts
162 *
163 * @param FormOptions $opts
164 * @return array
165 */
166 public function buildMainQueryConds( FormOptions $opts ) {
167 $dbr = $this->getDB();
168 $conds = parent::buildMainQueryConds( $opts );
169
170 // Calculate cutoff
171 $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
172 $cutoff_unixtime = $cutoff_unixtime - ( $cutoff_unixtime % 86400 );
173 $cutoff = $dbr->timestamp( $cutoff_unixtime );
174
175 $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
176 if ( $fromValid && $opts['from'] > wfTimestamp( TS_MW, $cutoff ) ) {
177 $cutoff = $dbr->timestamp( $opts['from'] );
178 } else {
179 $opts->reset( 'from' );
180 }
181
182 $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
183
184 return $conds;
185 }
186
187 /**
188 * Process the query
189 *
190 * @param array $conds
191 * @param FormOptions $opts
192 * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
193 */
194 public function doMainQuery( $conds, $opts ) {
195 global $wgAllowCategorizedRecentChanges;
196
197 $dbr = $this->getDB();
198 $user = $this->getUser();
199
200 $tables = array( 'recentchanges' );
201 $fields = RecentChange::selectFields();
202 $query_options = array();
203 $join_conds = array();
204
205 // JOIN on watchlist for users
206 if ( $user->getId() && $user->isAllowed( 'viewmywatchlist' ) ) {
207 $tables[] = 'watchlist';
208 $fields[] = 'wl_user';
209 $fields[] = 'wl_notificationtimestamp';
210 $join_conds['watchlist'] = array( 'LEFT JOIN', array(
211 'wl_user' => $user->getId(),
212 'wl_title=rc_title',
213 'wl_namespace=rc_namespace'
214 ) );
215 }
216
217 if ( $user->isAllowed( 'rollback' ) ) {
218 $tables[] = 'page';
219 $fields[] = 'page_latest';
220 $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
221 }
222
223 ChangeTags::modifyDisplayQuery(
224 $tables,
225 $fields,
226 $conds,
227 $join_conds,
228 $query_options,
229 $opts['tagfilter']
230 );
231
232 if ( !wfRunHooks( 'SpecialRecentChangesQuery',
233 array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ),
234 '1.23' )
235 ) {
236 return false;
237 }
238
239 // rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
240 // knowledge to use an index merge if it wants (it may use some other index though).
241 $rows = $dbr->select(
242 $tables,
243 $fields,
244 $conds + array( 'rc_new' => array( 0, 1 ) ),
245 __METHOD__,
246 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $opts['limit'] ) + $query_options,
247 $join_conds
248 );
249
250 // Build the final data
251 if ( $wgAllowCategorizedRecentChanges ) {
252 $this->filterByCategories( $rows, $opts );
253 }
254
255 return $rows;
256 }
257
258 public function outputFeedLinks() {
259 $this->addFeedLinks( $this->getFeedQuery() );
260 }
261
262 /**
263 * Get URL query parameters for action=feedrecentchanges API feed of current recent changes view.
264 *
265 * @return array
266 */
267 private function getFeedQuery() {
268 global $wgFeedLimit;
269 $query = array_filter( $this->getOptions()->getAllValues(), function ( $value ) {
270 // API handles empty parameters in a different way
271 return $value !== '';
272 } );
273 $query['action'] = 'feedrecentchanges';
274 if ( $query['limit'] > $wgFeedLimit ) {
275 $query['limit'] = $wgFeedLimit;
276 }
277
278 return $query;
279 }
280
281 /**
282 * Build and output the actual changes list.
283 *
284 * @param array $rows Database rows
285 * @param FormOptions $opts
286 */
287 public function outputChangesList( $rows, $opts ) {
288 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
289
290 $limit = $opts['limit'];
291
292 $showWatcherCount = $wgRCShowWatchingUsers
293 && $this->getUser()->getOption( 'shownumberswatching' );
294 $watcherCache = array();
295
296 $dbr = $this->getDB();
297
298 $counter = 1;
299 $list = ChangesList::newFromContext( $this->getContext() );
300 $list->initChangesListRows( $rows );
301
302 $rclistOutput = $list->beginRecentChangesList();
303 foreach ( $rows as $obj ) {
304 if ( $limit == 0 ) {
305 break;
306 }
307 $rc = RecentChange::newFromRow( $obj );
308 $rc->counter = $counter++;
309 # Check if the page has been updated since the last visit
310 if ( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp ) ) {
311 $rc->notificationtimestamp = ( $obj->rc_timestamp >= $obj->wl_notificationtimestamp );
312 } else {
313 $rc->notificationtimestamp = false; // Default
314 }
315 # Check the number of users watching the page
316 $rc->numberofWatchingusers = 0; // Default
317 if ( $showWatcherCount && $obj->rc_namespace >= 0 ) {
318 if ( !isset( $watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
319 $watcherCache[$obj->rc_namespace][$obj->rc_title] =
320 $dbr->selectField(
321 'watchlist',
322 'COUNT(*)',
323 array(
324 'wl_namespace' => $obj->rc_namespace,
325 'wl_title' => $obj->rc_title,
326 ),
327 __METHOD__ . '-watchers'
328 );
329 }
330 $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
331 }
332
333 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
334 if ( $changeLine !== false ) {
335 $rclistOutput .= $changeLine;
336 --$limit;
337 }
338 }
339 $rclistOutput .= $list->endRecentChangesList();
340
341 if ( $rows->numRows() === 0 ) {
342 $this->getOutput()->addHtml(
343 '<div class="mw-changeslist-empty">' .
344 $this->msg( 'recentchanges-noresult' )->parse() .
345 '</div>'
346 );
347 } else {
348 $this->getOutput()->addHTML( $rclistOutput );
349 }
350 }
351
352 /**
353 * Return the text to be displayed above the changes
354 *
355 * @param FormOptions $opts
356 * @return string XHTML
357 */
358 public function doHeader( $opts ) {
359 global $wgScript;
360
361 $this->setTopText( $opts );
362
363 $defaults = $opts->getAllValues();
364 $nondefaults = $opts->getChangedValues();
365
366 $panel = array();
367 $panel[] = self::makeLegend( $this->getContext() );
368 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
369 $panel[] = '<hr />';
370
371 $extraOpts = $this->getExtraOptions( $opts );
372 $extraOptsCount = count( $extraOpts );
373 $count = 0;
374 $submit = ' ' . Xml::submitbutton( $this->msg( 'allpagessubmit' )->text() );
375
376 $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
377 foreach ( $extraOpts as $name => $optionRow ) {
378 # Add submit button to the last row only
379 ++$count;
380 $addSubmit = ( $count === $extraOptsCount ) ? $submit : '';
381
382 $out .= Xml::openElement( 'tr' );
383 if ( is_array( $optionRow ) ) {
384 $out .= Xml::tags(
385 'td',
386 array( 'class' => 'mw-label mw-' . $name . '-label' ),
387 $optionRow[0]
388 );
389 $out .= Xml::tags(
390 'td',
391 array( 'class' => 'mw-input' ),
392 $optionRow[1] . $addSubmit
393 );
394 } else {
395 $out .= Xml::tags(
396 'td',
397 array( 'class' => 'mw-input', 'colspan' => 2 ),
398 $optionRow . $addSubmit
399 );
400 }
401 $out .= Xml::closeElement( 'tr' );
402 }
403 $out .= Xml::closeElement( 'table' );
404
405 $unconsumed = $opts->getUnconsumedValues();
406 foreach ( $unconsumed as $key => $value ) {
407 $out .= Html::hidden( $key, $value );
408 }
409
410 $t = $this->getPageTitle();
411 $out .= Html::hidden( 'title', $t->getPrefixedText() );
412 $form = Xml::tags( 'form', array( 'action' => $wgScript ), $out );
413 $panel[] = $form;
414 $panelString = implode( "\n", $panel );
415
416 $this->getOutput()->addHTML(
417 Xml::fieldset(
418 $this->msg( 'recentchanges-legend' )->text(),
419 $panelString,
420 array( 'class' => 'rcoptions' )
421 )
422 );
423
424 $this->setBottomText( $opts );
425 }
426
427 /**
428 * Send the text to be displayed above the options
429 *
430 * @param FormOptions $opts Unused
431 */
432 function setTopText( FormOptions $opts ) {
433 global $wgContLang;
434
435 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
436 if ( !$message->isDisabled() ) {
437 $this->getOutput()->addWikiText(
438 Html::rawElement( 'p',
439 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
440 "\n" . $message->plain() . "\n"
441 ),
442 /* $lineStart */ false,
443 /* $interface */ false
444 );
445 }
446 }
447
448 /**
449 * Get options to be displayed in a form
450 *
451 * @param FormOptions $opts
452 * @return array
453 */
454 function getExtraOptions( $opts ) {
455 $opts->consumeValues( array(
456 'namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any'
457 ) );
458
459 $extraOpts = array();
460 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
461
462 global $wgAllowCategorizedRecentChanges;
463 if ( $wgAllowCategorizedRecentChanges ) {
464 $extraOpts['category'] = $this->categoryFilterForm( $opts );
465 }
466
467 $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
468 if ( count( $tagFilter ) ) {
469 $extraOpts['tagfilter'] = $tagFilter;
470 }
471
472 // Don't fire the hook for subclasses. (Or should we?)
473 if ( $this->getName() === 'Recentchanges' ) {
474 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
475 }
476
477 return $extraOpts;
478 }
479
480 /**
481 * Add page-specific modules.
482 */
483 protected function addModules() {
484 parent::addModules();
485 $out = $this->getOutput();
486 $out->addModules( 'mediawiki.special.recentchanges' );
487 }
488
489 /**
490 * Get last modified date, for client caching
491 * Don't use this if we are using the patrol feature, patrol changes don't
492 * update the timestamp
493 *
494 * @return string|bool
495 */
496 public function checkLastModified() {
497 $dbr = $this->getDB();
498 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__ );
499
500 return $lastmod;
501 }
502
503 /**
504 * Creates the choose namespace selection
505 *
506 * @param FormOptions $opts
507 * @return string
508 */
509 protected function namespaceFilterForm( FormOptions $opts ) {
510 $nsSelect = Html::namespaceSelector(
511 array( 'selected' => $opts['namespace'], 'all' => '' ),
512 array( 'name' => 'namespace', 'id' => 'namespace' )
513 );
514 $nsLabel = Xml::label( $this->msg( 'namespace' )->text(), 'namespace' );
515 $invert = Xml::checkLabel(
516 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
517 $opts['invert'],
518 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
519 );
520 $associated = Xml::checkLabel(
521 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
522 $opts['associated'],
523 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
524 );
525
526 return array( $nsLabel, "$nsSelect $invert $associated" );
527 }
528
529 /**
530 * Create an input to filter changes by categories
531 *
532 * @param FormOptions $opts
533 * @return array
534 */
535 protected function categoryFilterForm( FormOptions $opts ) {
536 list( $label, $input ) = Xml::inputLabelSep( $this->msg( 'rc_categories' )->text(),
537 'categories', 'mw-categories', false, $opts['categories'] );
538
539 $input .= ' ' . Xml::checkLabel( $this->msg( 'rc_categories_any' )->text(),
540 'categories_any', 'mw-categories_any', $opts['categories_any'] );
541
542 return array( $label, $input );
543 }
544
545 /**
546 * Filter $rows by categories set in $opts
547 *
548 * @param ResultWrapper $rows Database rows
549 * @param FormOptions $opts
550 */
551 function filterByCategories( &$rows, FormOptions $opts ) {
552 $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
553
554 if ( !count( $categories ) ) {
555 return;
556 }
557
558 # Filter categories
559 $cats = array();
560 foreach ( $categories as $cat ) {
561 $cat = trim( $cat );
562 if ( $cat == '' ) {
563 continue;
564 }
565 $cats[] = $cat;
566 }
567
568 # Filter articles
569 $articles = array();
570 $a2r = array();
571 $rowsarr = array();
572 foreach ( $rows as $k => $r ) {
573 $nt = Title::makeTitle( $r->rc_namespace, $r->rc_title );
574 $id = $nt->getArticleID();
575 if ( $id == 0 ) {
576 continue; # Page might have been deleted...
577 }
578 if ( !in_array( $id, $articles ) ) {
579 $articles[] = $id;
580 }
581 if ( !isset( $a2r[$id] ) ) {
582 $a2r[$id] = array();
583 }
584 $a2r[$id][] = $k;
585 $rowsarr[$k] = $r;
586 }
587
588 # Shortcut?
589 if ( !count( $articles ) || !count( $cats ) ) {
590 return;
591 }
592
593 # Look up
594 $c = new Categoryfinder;
595 $c->seed( $articles, $cats, $opts['categories_any'] ? 'OR' : 'AND' );
596 $match = $c->run();
597
598 # Filter
599 $newrows = array();
600 foreach ( $match as $id ) {
601 foreach ( $a2r[$id] as $rev ) {
602 $k = $rev;
603 $newrows[$k] = $rowsarr[$k];
604 }
605 }
606 $rows = $newrows;
607 }
608
609 /**
610 * Makes change an option link which carries all the other options
611 *
612 * @param string $title Title
613 * @param array $override Options to override
614 * @param array $options Current options
615 * @param bool $active Whether to show the link in bold
616 * @return string
617 */
618 function makeOptionsLink( $title, $override, $options, $active = false ) {
619 $params = $override + $options;
620
621 // Bug 36524: false values have be converted to "0" otherwise
622 // wfArrayToCgi() will omit it them.
623 foreach ( $params as &$value ) {
624 if ( $value === false ) {
625 $value = '0';
626 }
627 }
628 unset( $value );
629
630 $text = htmlspecialchars( $title );
631 if ( $active ) {
632 $text = '<strong>' . $text . '</strong>';
633 }
634
635 return Linker::linkKnown( $this->getPageTitle(), $text, array(), $params );
636 }
637
638 /**
639 * Creates the options panel.
640 *
641 * @param array $defaults
642 * @param array $nondefaults
643 * @return string
644 */
645 function optionsPanel( $defaults, $nondefaults ) {
646 global $wgRCLinkLimits, $wgRCLinkDays;
647
648 $options = $nondefaults + $defaults;
649
650 $note = '';
651 $msg = $this->msg( 'rclegend' );
652 if ( !$msg->isDisabled() ) {
653 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
654 }
655
656 $lang = $this->getLanguage();
657 $user = $this->getUser();
658 if ( $options['from'] ) {
659 $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
660 $lang->userTimeAndDate( $options['from'], $user ),
661 $lang->userDate( $options['from'], $user ),
662 $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
663 }
664
665 # Sort data for display and make sure it's unique after we've added user data.
666 $linkLimits = $wgRCLinkLimits;
667 $linkLimits[] = $options['limit'];
668 sort( $linkLimits );
669 $linkLimits = array_unique( $linkLimits );
670
671 $linkDays = $wgRCLinkDays;
672 $linkDays[] = $options['days'];
673 sort( $linkDays );
674 $linkDays = array_unique( $linkDays );
675
676 // limit links
677 $cl = array();
678 foreach ( $linkLimits as $value ) {
679 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
680 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
681 }
682 $cl = $lang->pipeList( $cl );
683
684 // day links, reset 'from' to none
685 $dl = array();
686 foreach ( $linkDays as $value ) {
687 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
688 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
689 }
690 $dl = $lang->pipeList( $dl );
691
692 // show/hide links
693 $filters = array(
694 'hideminor' => 'rcshowhideminor',
695 'hidebots' => 'rcshowhidebots',
696 'hideanons' => 'rcshowhideanons',
697 'hideliu' => 'rcshowhideliu',
698 'hidepatrolled' => 'rcshowhidepatr',
699 'hidemyself' => 'rcshowhidemine'
700 );
701
702 $showhide = array( 'show', 'hide' );
703
704 foreach ( $this->getCustomFilters() as $key => $params ) {
705 $filters[$key] = $params['msg'];
706 }
707 // Disable some if needed
708 if ( !$user->useRCPatrol() ) {
709 unset( $filters['hidepatrolled'] );
710 }
711
712 $links = array();
713 foreach ( $filters as $key => $msg ) {
714 // The following messages are used here:
715 // rcshowhideminor-show, rcshowhideminor-hide, rcshowhidebots-show, rcshowhidebots-hide,
716 // rcshowhideanons-show, rcshowhideanons-hide, rcshowhideliu-show, rcshowhideliu-hide,
717 // rcshowhidepatr-show, rcshowhidepatr-hide, rcshowhidemine-show, rcshowhidemine-hide.
718 $linkMessage = $this->msg( $msg . '-' . $showhide[1 - $options[$key]] );
719 // Extensions can define additional filters, but don't need to define the corresponding
720 // messages. If they don't exist, just fall back to 'show' and 'hide'.
721 if ( !$linkMessage->exists() ) {
722 $linkMessage = $this->msg( $showhide[1 - $options[$key]] );
723 }
724
725 $link = $this->makeOptionsLink( $linkMessage->text(),
726 array( $key => 1 - $options[$key] ), $nondefaults );
727 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
728 }
729
730 // show from this onward link
731 $timestamp = wfTimestampNow();
732 $now = $lang->userTimeAndDate( $timestamp, $user );
733 $timenow = $lang->userTime( $timestamp, $user );
734 $datenow = $lang->userDate( $timestamp, $user );
735 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )
736 ->parse();
737 $rclistfrom = $this->makeOptionsLink(
738 $this->msg( 'rclistfrom' )->rawParams( $now, $timenow, $datenow )->parse(),
739 array( 'from' => $timestamp ),
740 $nondefaults
741 );
742
743 return "{$note}$rclinks<br />$rclistfrom";
744 }
745
746 public function isIncludable() {
747 return true;
748 }
749 }