Merge "Revert "Adding ability of jQuery badge to display the number zero if requested.""
[lhc/web/wiklou.git] / includes / ChangesList.php
1 <?php
2 /**
3 * Classes to show lists of changes.
4 *
5 * These can be:
6 * - watchlist
7 * - related changes
8 * - recent changes
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * http://www.gnu.org/copyleft/gpl.html
24 *
25 * @file
26 */
27
28 /**
29 * @todo document
30 */
31 class RCCacheEntry extends RecentChange {
32 var $secureName, $link;
33 var $curlink , $difflink, $lastlink, $usertalklink, $versionlink;
34 var $userlink, $timestamp, $watched;
35
36 /**
37 * @param $rc RecentChange
38 * @return RCCacheEntry
39 */
40 static function newFromParent( $rc ) {
41 $rc2 = new RCCacheEntry;
42 $rc2->mAttribs = $rc->mAttribs;
43 $rc2->mExtra = $rc->mExtra;
44 return $rc2;
45 }
46 }
47
48 /**
49 * Base class for all changes lists
50 */
51 class ChangesList extends ContextSource {
52
53 /**
54 * @var Skin
55 */
56 public $skin;
57
58 protected $watchlist = false;
59
60 protected $message;
61
62 /**
63 * Changeslist contructor
64 *
65 * @param $obj Skin or IContextSource
66 */
67 public function __construct( $obj ) {
68 if ( $obj instanceof IContextSource ) {
69 $this->setContext( $obj );
70 $this->skin = $obj->getSkin();
71 } else {
72 $this->setContext( $obj->getContext() );
73 $this->skin = $obj;
74 }
75 $this->preCacheMessages();
76 }
77
78 /**
79 * Fetch an appropriate changes list class for the main context
80 * This first argument used to be an User object.
81 *
82 * @deprecated in 1.18; use newFromContext() instead
83 * @param $unused string|User Unused
84 * @return ChangesList|EnhancedChangesList|OldChangesList derivative
85 */
86 public static function newFromUser( $unused ) {
87 wfDeprecated( __METHOD__, '1.18' );
88 return self::newFromContext( RequestContext::getMain() );
89 }
90
91 /**
92 * Fetch an appropriate changes list class for the specified context
93 * Some users might want to use an enhanced list format, for instance
94 *
95 * @param $context IContextSource to use
96 * @return ChangesList|EnhancedChangesList|OldChangesList derivative
97 */
98 public static function newFromContext( IContextSource $context ) {
99 $user = $context->getUser();
100 $sk = $context->getSkin();
101 $list = null;
102 if( wfRunHooks( 'FetchChangesList', array( $user, &$sk, &$list ) ) ) {
103 $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
104 return $new ? new EnhancedChangesList( $context ) : new OldChangesList( $context );
105 } else {
106 return $list;
107 }
108 }
109
110 /**
111 * Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag
112 * @param $value Boolean
113 */
114 public function setWatchlistDivs( $value = true ) {
115 $this->watchlist = $value;
116 }
117
118 /**
119 * As we use the same small set of messages in various methods and that
120 * they are called often, we call them once and save them in $this->message
121 */
122 private function preCacheMessages() {
123 if( !isset( $this->message ) ) {
124 foreach ( explode( ' ', 'cur diff hist last blocklink history ' .
125 'semicolon-separator pipe-separator' ) as $msg ) {
126 $this->message[$msg] = $this->msg( $msg )->escaped();
127 }
128 }
129 }
130
131 /**
132 * Returns the appropriate flags for new page, minor change and patrolling
133 * @param $flags Array Associative array of 'flag' => Bool
134 * @param $nothing String to use for empty space
135 * @return String
136 */
137 protected function recentChangesFlags( $flags, $nothing = '&#160;' ) {
138 $f = '';
139 foreach( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ){
140 $f .= isset( $flags[$flag] ) && $flags[$flag]
141 ? self::flag( $flag )
142 : $nothing;
143 }
144 return $f;
145 }
146
147 /**
148 * Provide the "<abbr>" element appropriate to a given abbreviated flag,
149 * namely the flag indicating a new page, a minor edit, a bot edit, or an
150 * unpatrolled edit. By default in English it will contain "N", "m", "b",
151 * "!" respectively, plus it will have an appropriate title and class.
152 *
153 * @param $flag String: 'newpage', 'unpatrolled', 'minor', or 'bot'
154 * @return String: Raw HTML
155 */
156 public static function flag( $flag ) {
157 static $messages = null;
158 if ( is_null( $messages ) ) {
159 $messages = array(
160 'newpage' => array( 'newpageletter', 'recentchanges-label-newpage' ),
161 'minoredit' => array( 'minoreditletter', 'recentchanges-label-minor' ),
162 'botedit' => array( 'boteditletter', 'recentchanges-label-bot' ),
163 'unpatrolled' => array( 'unpatrolledletter', 'recentchanges-label-unpatrolled' ),
164 );
165 foreach( $messages as &$value ) {
166 $value[0] = wfMessage( $value[0] )->escaped();
167 $value[1] = wfMessage( $value[1] )->escaped();
168 }
169 }
170
171 # Inconsistent naming, bleh
172 $map = array(
173 'newpage' => 'newpage',
174 'minor' => 'minoredit',
175 'bot' => 'botedit',
176 'unpatrolled' => 'unpatrolled',
177 'minoredit' => 'minoredit',
178 'botedit' => 'botedit',
179 );
180 $flag = $map[$flag];
181
182 return "<abbr class='$flag' title='" . $messages[$flag][1] . "'>" . $messages[$flag][0] . '</abbr>';
183 }
184
185 /**
186 * Returns text for the start of the tabular part of RC
187 * @return String
188 */
189 public function beginRecentChangesList() {
190 $this->rc_cache = array();
191 $this->rcMoveIndex = 0;
192 $this->rcCacheIndex = 0;
193 $this->lastdate = '';
194 $this->rclistOpen = false;
195 $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
196 return '';
197 }
198
199 /**
200 * Show formatted char difference
201 * @param $old Integer: bytes
202 * @param $new Integer: bytes
203 * @param $context IContextSource context to use
204 * @return String
205 */
206 public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
207 global $wgRCChangedSizeThreshold, $wgMiserMode;
208
209 if ( !$context ) {
210 $context = RequestContext::getMain();
211 }
212
213 $new = (int)$new;
214 $old = (int)$old;
215 $szdiff = $new - $old;
216
217 $lang = $context->getLanguage();
218 $code = $lang->getCode();
219 static $fastCharDiff = array();
220 if ( !isset($fastCharDiff[$code]) ) {
221 $fastCharDiff[$code] = $wgMiserMode || $context->msg( 'rc-change-size' )->plain() === '$1';
222 }
223
224 $formattedSize = $lang->formatNum( $szdiff );
225
226 if ( !$fastCharDiff[$code] ) {
227 $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
228 }
229
230 if( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
231 $tag = 'strong';
232 } else {
233 $tag = 'span';
234 }
235
236 if ( $szdiff === 0 ) {
237 $formattedSizeClass = 'mw-plusminus-null';
238 }
239 if ( $szdiff > 0 ) {
240 $formattedSize = '+' . $formattedSize;
241 $formattedSizeClass = 'mw-plusminus-pos';
242 }
243 if ( $szdiff < 0 ) {
244 $formattedSizeClass = 'mw-plusminus-neg';
245 }
246
247 $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
248
249 return Html::element( $tag,
250 array( 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ),
251 $context->msg( 'parentheses', $formattedSize )->plain() ) . $lang->getDirMark();
252 }
253
254 /**
255 * Format the character difference of one or several changes.
256 *
257 * @param $old RecentChange
258 * @param $new RecentChange last change to use, if not provided, $old will be used
259 * @return string HTML fragment
260 */
261 public function formatCharacterDifference( RecentChange $old, RecentChange $new = null ) {
262 $oldlen = $old->mAttribs['rc_old_len'];
263
264 if ( $new ) {
265 $newlen = $new->mAttribs['rc_new_len'];
266 } else {
267 $newlen = $old->mAttribs['rc_new_len'];
268 }
269
270 if( $oldlen === null || $newlen === null ) {
271 return '';
272 }
273
274 return self::showCharacterDifference( $oldlen, $newlen, $this->getContext() );
275 }
276
277 /**
278 * Returns text for the end of RC
279 * @return String
280 */
281 public function endRecentChangesList() {
282 if( $this->rclistOpen ) {
283 return "</ul>\n";
284 } else {
285 return '';
286 }
287 }
288
289 public function insertDateHeader( &$s, $rc_timestamp ) {
290 # Make date header if necessary
291 $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
292 if( $date != $this->lastdate ) {
293 if( $this->lastdate != '' ) {
294 $s .= "</ul>\n";
295 }
296 $s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
297 $this->lastdate = $date;
298 $this->rclistOpen = true;
299 }
300 }
301
302 public function insertLog( &$s, $title, $logtype ) {
303 $page = new LogPage( $logtype );
304 $logname = $page->getName()->escaped();
305 $s .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $title, $logname ) )->escaped();
306 }
307
308 /**
309 * @param $s
310 * @param $rc RecentChange
311 * @param $unpatrolled
312 */
313 public function insertDiffHist( &$s, &$rc, $unpatrolled ) {
314 # Diff link
315 if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
316 $diffLink = $this->message['diff'];
317 } elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
318 $diffLink = $this->message['diff'];
319 } else {
320 $query = array(
321 'curid' => $rc->mAttribs['rc_cur_id'],
322 'diff' => $rc->mAttribs['rc_this_oldid'],
323 'oldid' => $rc->mAttribs['rc_last_oldid']
324 );
325
326 if( $unpatrolled ) {
327 $query['rcid'] = $rc->mAttribs['rc_id'];
328 };
329
330 $diffLink = Linker::linkKnown(
331 $rc->getTitle(),
332 $this->message['diff'],
333 array( 'tabindex' => $rc->counter ),
334 $query
335 );
336 }
337 $diffhist = $diffLink . $this->message['pipe-separator'];
338 # History link
339 $diffhist .= Linker::linkKnown(
340 $rc->getTitle(),
341 $this->message['hist'],
342 array(),
343 array(
344 'curid' => $rc->mAttribs['rc_cur_id'],
345 'action' => 'history'
346 )
347 );
348 $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() . ' <span class="mw-changeslist-separator">. .</span> ';
349 }
350
351 /**
352 * @param $s
353 * @param $rc RecentChange
354 * @param $unpatrolled
355 * @param $watched
356 */
357 public function insertArticleLink( &$s, &$rc, $unpatrolled, $watched ) {
358 # If it's a new article, there is no diff link, but if it hasn't been
359 # patrolled yet, we need to give users a way to do so
360 $params = array();
361
362 if ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW ) {
363 $params['rcid'] = $rc->mAttribs['rc_id'];
364 }
365
366 $articlelink = Linker::linkKnown(
367 $rc->getTitle(),
368 null,
369 array( 'class' => 'mw-changeslist-title' ),
370 $params
371 );
372 if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
373 $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
374 }
375 # To allow for boldening pages watched by this user
376 $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
377 # RTL/LTR marker
378 $articlelink .= $this->getLanguage()->getDirMark();
379
380 wfRunHooks( 'ChangesListInsertArticleLink',
381 array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) );
382
383 $s .= " $articlelink";
384 }
385
386 /**
387 * @param $s
388 * @param $rc RecentChange
389 */
390 public function insertTimestamp( &$s, $rc ) {
391 $s .= $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
392 $this->getLanguage()->userTime( $rc->mAttribs['rc_timestamp'], $this->getUser() ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
393 }
394
395 /**
396 * Insert links to user page, user talk page and eventually a blocking link
397 *
398 * @param &$s String HTML to update
399 * @param &$rc RecentChange
400 */
401 public function insertUserRelatedLinks( &$s, &$rc ) {
402 if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
403 $s .= ' <span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
404 } else {
405 $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
406 $rc->mAttribs['rc_user_text'] );
407 $s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
408 }
409 }
410
411 /**
412 * Insert a formatted action
413 *
414 * @param $rc RecentChange
415 * @return string
416 */
417 public function insertLogEntry( $rc ) {
418 $formatter = LogFormatter::newFromRow( $rc->mAttribs );
419 $formatter->setContext( $this->getContext() );
420 $formatter->setShowUserToolLinks( true );
421 $mark = $this->getLanguage()->getDirMark();
422 return $formatter->getActionText() . " $mark" . $formatter->getComment();
423 }
424
425 /**
426 * Insert a formatted comment
427 * @param $rc RecentChange
428 * @return string
429 */
430 public function insertComment( $rc ) {
431 if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
432 if( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
433 return ' <span class="history-deleted">' . $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
434 } else {
435 return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
436 }
437 }
438 return '';
439 }
440
441 /**
442 * Check whether to enable recent changes patrol features
443 * @return Boolean
444 */
445 public static function usePatrol() {
446 global $wgUser;
447 return $wgUser->useRCPatrol();
448 }
449
450 /**
451 * Returns the string which indicates the number of watching users
452 * @return string
453 */
454 protected function numberofWatchingusers( $count ) {
455 static $cache = array();
456 if( $count > 0 ) {
457 if( !isset( $cache[$count] ) ) {
458 $cache[$count] = $this->msg( 'number_of_watching_users_RCview' )->numParams( $count )->escaped();
459 }
460 return $cache[$count];
461 } else {
462 return '';
463 }
464 }
465
466 /**
467 * Determine if said field of a revision is hidden
468 * @param $rc RCCacheEntry
469 * @param $field Integer: one of DELETED_* bitfield constants
470 * @return Boolean
471 */
472 public static function isDeleted( $rc, $field ) {
473 return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
474 }
475
476 /**
477 * Determine if the current user is allowed to view a particular
478 * field of this revision, if it's marked as deleted.
479 * @param $rc RCCacheEntry
480 * @param $field Integer
481 * @param $user User object to check, or null to use $wgUser
482 * @return Boolean
483 */
484 public static function userCan( $rc, $field, User $user = null ) {
485 if( $rc->mAttribs['rc_type'] == RC_LOG ) {
486 return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
487 } else {
488 return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
489 }
490 }
491
492 /**
493 * @param $link string
494 * @param $watched bool
495 * @return string
496 */
497 protected function maybeWatchedLink( $link, $watched = false ) {
498 if( $watched ) {
499 return '<strong class="mw-watched">' . $link . '</strong>';
500 } else {
501 return '<span class="mw-rc-unwatched">' . $link . '</span>';
502 }
503 }
504
505 /** Inserts a rollback link
506 *
507 * @param $s string
508 * @param $rc RecentChange
509 */
510 public function insertRollback( &$s, &$rc ) {
511 if( $rc->mAttribs['rc_type'] != RC_NEW && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
512 $page = $rc->getTitle();
513 /** Check for rollback and edit permissions, disallow special pages, and only
514 * show a link on the top-most revision */
515 if ( $this->getUser()->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] )
516 {
517 $rev = new Revision( array(
518 'title' => $page,
519 'id' => $rc->mAttribs['rc_this_oldid'],
520 'user' => $rc->mAttribs['rc_user'],
521 'user_text' => $rc->mAttribs['rc_user_text'],
522 'deleted' => $rc->mAttribs['rc_deleted']
523 ) );
524 $s .= ' '.Linker::generateRollback( $rev, $this->getContext() );
525 }
526 }
527 }
528
529 /**
530 * @param $s string
531 * @param $rc RecentChange
532 * @param $classes
533 */
534 public function insertTags( &$s, &$rc, &$classes ) {
535 if ( empty($rc->mAttribs['ts_tags']) )
536 return;
537
538 list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' );
539 $classes = array_merge( $classes, $newClasses );
540 $s .= ' ' . $tagSummary;
541 }
542
543 public function insertExtra( &$s, &$rc, &$classes ) {
544 ## Empty, used for subclassers to add anything special.
545 }
546
547 protected function showAsUnpatrolled( RecentChange $rc ) {
548 $unpatrolled = false;
549 if ( !$rc->mAttribs['rc_patrolled'] ) {
550 if ( $this->getUser()->useRCPatrol() ) {
551 $unpatrolled = true;
552 } elseif ( $this->getUser()->useNPPatrol() && $rc->mAttribs['rc_type'] == RC_NEW ) {
553 $unpatrolled = true;
554 }
555 }
556 return $unpatrolled;
557 }
558 }
559
560
561 /**
562 * Generate a list of changes using the good old system (no javascript)
563 */
564 class OldChangesList extends ChangesList {
565 /**
566 * Format a line using the old system (aka without any javascript).
567 *
568 * @param $rc RecentChange, passed by reference
569 * @param $watched Bool (default false)
570 * @param $linenumber Int (default null)
571 * @return string
572 */
573 public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
574 global $wgRCShowChangedSize;
575 wfProfileIn( __METHOD__ );
576
577 # Should patrol-related stuff be shown?
578 $unpatrolled = $this->showAsUnpatrolled( $rc );
579
580 $dateheader = ''; // $s now contains only <li>...</li>, for hooks' convenience.
581 $this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] );
582
583 $s = '';
584 $classes = array();
585 // use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
586 if( $linenumber ) {
587 if( $linenumber & 1 ) {
588 $classes[] = 'mw-line-odd';
589 }
590 else {
591 $classes[] = 'mw-line-even';
592 }
593 }
594
595 // Indicate watched status on the line to allow for more
596 // comprehensive styling.
597 $classes[] = $watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
598
599 // Moved pages (very very old, not supported anymore)
600 if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
601 // Log entries
602 } elseif( $rc->mAttribs['rc_log_type'] ) {
603 $logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
604 $this->insertLog( $s, $logtitle, $rc->mAttribs['rc_log_type'] );
605 // Log entries (old format) or log targets, and special pages
606 } elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
607 list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $rc->mAttribs['rc_title'] );
608 if( $name == 'Log' ) {
609 $this->insertLog( $s, $rc->getTitle(), $subpage );
610 }
611 // Regular entries
612 } else {
613 $this->insertDiffHist( $s, $rc, $unpatrolled );
614 # M, N, b and ! (minor, new, bot and unpatrolled)
615 $s .= $this->recentChangesFlags(
616 array(
617 'newpage' => $rc->mAttribs['rc_type'] == RC_NEW,
618 'minor' => $rc->mAttribs['rc_minor'],
619 'unpatrolled' => $unpatrolled,
620 'bot' => $rc->mAttribs['rc_bot']
621 ),
622 ''
623 );
624 $this->insertArticleLink( $s, $rc, $unpatrolled, $watched );
625 }
626 # Edit/log timestamp
627 $this->insertTimestamp( $s, $rc );
628 # Bytes added or removed
629 if ( $wgRCShowChangedSize ) {
630 $cd = $this->formatCharacterDifference( $rc );
631 if ( $cd !== '' ) {
632 $s .= $cd . ' <span class="mw-changeslist-separator">. .</span> ';
633 }
634 }
635
636 if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
637 $s .= $this->insertLogEntry( $rc );
638 } else {
639 # User tool links
640 $this->insertUserRelatedLinks( $s, $rc );
641 # LTR/RTL direction mark
642 $s .= $this->getLanguage()->getDirMark();
643 $s .= $this->insertComment( $rc );
644 }
645
646 # Tags
647 $this->insertTags( $s, $rc, $classes );
648 # Rollback
649 $this->insertRollback( $s, $rc );
650 # For subclasses
651 $this->insertExtra( $s, $rc, $classes );
652
653 # How many users watch this page
654 if( $rc->numberofWatchingusers > 0 ) {
655 $s .= ' ' . $this->numberofWatchingusers( $rc->numberofWatchingusers );
656 }
657
658 if( $this->watchlist ) {
659 $classes[] = Sanitizer::escapeClass( 'watchlist-'.$rc->mAttribs['rc_namespace'].'-'.$rc->mAttribs['rc_title'] );
660 }
661
662 wfRunHooks( 'OldChangesListRecentChangesLine', array(&$this, &$s, $rc) );
663
664 wfProfileOut( __METHOD__ );
665 return "$dateheader<li class=\"".implode( ' ', $classes )."\">".$s."</li>\n";
666 }
667 }
668
669
670 /**
671 * Generate a list of changes using an Enhanced system (uses javascript).
672 */
673 class EnhancedChangesList extends ChangesList {
674
675 protected $rc_cache;
676
677 /**
678 * Add the JavaScript file for enhanced changeslist
679 * @return String
680 */
681 public function beginRecentChangesList() {
682 $this->rc_cache = array();
683 $this->rcMoveIndex = 0;
684 $this->rcCacheIndex = 0;
685 $this->lastdate = '';
686 $this->rclistOpen = false;
687 $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
688 return '';
689 }
690 /**
691 * Format a line for enhanced recentchange (aka with javascript and block of lines).
692 *
693 * @param $baseRC RecentChange
694 * @param $watched bool
695 *
696 * @return string
697 */
698 public function recentChangesLine( &$baseRC, $watched = false ) {
699 wfProfileIn( __METHOD__ );
700
701 # Create a specialised object
702 $rc = RCCacheEntry::newFromParent( $baseRC );
703
704 $curIdEq = array( 'curid' => $rc->mAttribs['rc_cur_id'] );
705
706 # If it's a new day, add the headline and flush the cache
707 $date = $this->getLanguage()->userDate( $rc->mAttribs['rc_timestamp'], $this->getUser() );
708 $ret = '';
709 if( $date != $this->lastdate ) {
710 # Process current cache
711 $ret = $this->recentChangesBlock();
712 $this->rc_cache = array();
713 $ret .= Xml::element( 'h4', null, $date ) . "\n";
714 $this->lastdate = $date;
715 }
716
717 # Should patrol-related stuff be shown?
718 $rc->unpatrolled = $this->showAsUnpatrolled( $rc );
719
720 $showdifflinks = true;
721 # Make article link
722 $type = $rc->mAttribs['rc_type'];
723 $logType = $rc->mAttribs['rc_log_type'];
724 // Page moves, very old style, not supported anymore
725 if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
726 // New unpatrolled pages
727 } elseif( $rc->unpatrolled && $type == RC_NEW ) {
728 $clink = Linker::linkKnown( $rc->getTitle(), null, array(),
729 array( 'rcid' => $rc->mAttribs['rc_id'] ) );
730 // Log entries
731 } elseif( $type == RC_LOG ) {
732 if( $logType ) {
733 $logtitle = SpecialPage::getTitleFor( 'Log', $logType );
734 $logpage = new LogPage( $logType );
735 $logname = $logpage->getName()->escaped();
736 $clink = $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logtitle, $logname ) )->escaped();
737 } else {
738 $clink = Linker::link( $rc->getTitle() );
739 }
740 $watched = false;
741 // Log entries (old format) and special pages
742 } elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
743 wfDebug( "Unexpected special page in recentchanges\n" );
744 $clink = '';
745 // Edits
746 } else {
747 $clink = Linker::linkKnown( $rc->getTitle() );
748 }
749
750 # Don't show unusable diff links
751 if ( !ChangesList::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
752 $showdifflinks = false;
753 }
754
755 $time = $this->getLanguage()->userTime( $rc->mAttribs['rc_timestamp'], $this->getUser() );
756 $rc->watched = $watched;
757 $rc->link = $clink;
758 $rc->timestamp = $time;
759 $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
760
761 # Make "cur" and "diff" links. Do not use link(), it is too slow if
762 # called too many times (50% of CPU time on RecentChanges!).
763 $thisOldid = $rc->mAttribs['rc_this_oldid'];
764 $lastOldid = $rc->mAttribs['rc_last_oldid'];
765 if( $rc->unpatrolled ) {
766 $rcIdQuery = array( 'rcid' => $rc->mAttribs['rc_id'] );
767 } else {
768 $rcIdQuery = array();
769 }
770 $querycur = $curIdEq + array( 'diff' => '0', 'oldid' => $thisOldid );
771 $querydiff = $curIdEq + array( 'diff' => $thisOldid, 'oldid' =>
772 $lastOldid ) + $rcIdQuery;
773
774 if( !$showdifflinks ) {
775 $curLink = $this->message['cur'];
776 $diffLink = $this->message['diff'];
777 } elseif( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
778 if ( $type != RC_NEW ) {
779 $curLink = $this->message['cur'];
780 } else {
781 $curUrl = htmlspecialchars( $rc->getTitle()->getLinkURL( $querycur ) );
782 $curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
783 }
784 $diffLink = $this->message['diff'];
785 } else {
786 $diffUrl = htmlspecialchars( $rc->getTitle()->getLinkURL( $querydiff ) );
787 $curUrl = htmlspecialchars( $rc->getTitle()->getLinkURL( $querycur ) );
788 $diffLink = "<a href=\"$diffUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['diff']}</a>";
789 $curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
790 }
791
792 # Make "last" link
793 if( !$showdifflinks || !$lastOldid ) {
794 $lastLink = $this->message['last'];
795 } elseif( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
796 $lastLink = $this->message['last'];
797 } else {
798 $lastLink = Linker::linkKnown( $rc->getTitle(), $this->message['last'],
799 array(), $curIdEq + array('diff' => $thisOldid, 'oldid' => $lastOldid) + $rcIdQuery );
800 }
801
802 # Make user links
803 if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
804 $rc->userlink = ' <span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
805 } else {
806 $rc->userlink = Linker::userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
807 $rc->usertalklink = Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
808 }
809
810 $rc->lastlink = $lastLink;
811 $rc->curlink = $curLink;
812 $rc->difflink = $diffLink;
813
814 # Put accumulated information into the cache, for later display
815 # Page moves go on their own line
816 $title = $rc->getTitle();
817 $secureName = $title->getPrefixedDBkey();
818 if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
819 # Use an @ character to prevent collision with page names
820 $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
821 } else {
822 # Logs are grouped by type
823 if( $type == RC_LOG ){
824 $secureName = SpecialPage::getTitleFor( 'Log', $logType )->getPrefixedDBkey();
825 }
826 if( !isset( $this->rc_cache[$secureName] ) ) {
827 $this->rc_cache[$secureName] = array();
828 }
829
830 array_push( $this->rc_cache[$secureName], $rc );
831 }
832
833 wfProfileOut( __METHOD__ );
834
835 return $ret;
836 }
837
838 /**
839 * Enhanced RC group
840 * @return string
841 */
842 protected function recentChangesBlockGroup( $block ) {
843 global $wgRCShowChangedSize;
844
845 wfProfileIn( __METHOD__ );
846
847 # Add the namespace and title of the block as part of the class
848 $classes = array( 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc' );
849 if ( $block[0]->mAttribs['rc_log_type'] ) {
850 # Log entry
851 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
852 . $block[0]->mAttribs['rc_log_type'] . '-' . $block[0]->mAttribs['rc_title'] );
853 } else {
854 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
855 . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
856 }
857 $classes[] = $block[0]->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
858 $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
859 Html::openElement( 'tr' );
860
861 # Collate list of users
862 $userlinks = array();
863 # Other properties
864 $unpatrolled = false;
865 $isnew = false;
866 $allBots = true;
867 $allMinors = true;
868 $curId = $currentRevision = 0;
869 # Some catalyst variables...
870 $namehidden = true;
871 $allLogs = true;
872 foreach( $block as $rcObj ) {
873 $oldid = $rcObj->mAttribs['rc_last_oldid'];
874 if( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
875 $isnew = true;
876 }
877 // If all log actions to this page were hidden, then don't
878 // give the name of the affected page for this block!
879 if( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
880 $namehidden = false;
881 }
882 $u = $rcObj->userlink;
883 if( !isset( $userlinks[$u] ) ) {
884 $userlinks[$u] = 0;
885 }
886 if( $rcObj->unpatrolled ) {
887 $unpatrolled = true;
888 }
889 if( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
890 $allLogs = false;
891 }
892 # Get the latest entry with a page_id and oldid
893 # since logs may not have these.
894 if( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
895 $curId = $rcObj->mAttribs['rc_cur_id'];
896 }
897 if( !$currentRevision && $rcObj->mAttribs['rc_this_oldid'] ) {
898 $currentRevision = $rcObj->mAttribs['rc_this_oldid'];
899 }
900
901 if( !$rcObj->mAttribs['rc_bot'] ) {
902 $allBots = false;
903 }
904 if( !$rcObj->mAttribs['rc_minor'] ) {
905 $allMinors = false;
906 }
907
908 $userlinks[$u]++;
909 }
910
911 # Sort the list and convert to text
912 krsort( $userlinks );
913 asort( $userlinks );
914 $users = array();
915 foreach( $userlinks as $userlink => $count) {
916 $text = $userlink;
917 $text .= $this->getLanguage()->getDirMark();
918 if( $count > 1 ) {
919 $text .= ' ' . $this->msg( 'parentheses' )->rawParams( $this->getLanguage()->formatNum( $count ) . '×' )->escaped();
920 }
921 array_push( $users, $text );
922 }
923
924 $users = ' <span class="changedby">'
925 . $this->msg( 'brackets' )->rawParams(
926 implode( $this->message['semicolon-separator'], $users )
927 )->escaped() . '</span>';
928
929 $tl = '<span class="mw-collapsible-toggle mw-enhancedchanges-arrow"></span>';
930 $r .= "<td>$tl</td>";
931
932 # Main line
933 $r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags( array(
934 'newpage' => $isnew, # show, when one have this flag
935 'minor' => $allMinors, # show only, when all have this flag
936 'unpatrolled' => $unpatrolled, # show, when one have this flag
937 'bot' => $allBots, # show only, when all have this flag
938 ) );
939
940 # Timestamp
941 $r .= '&#160;'.$block[0]->timestamp.'&#160;</td><td>';
942
943 # Article link
944 if( $namehidden ) {
945 $r .= ' <span class="history-deleted">' . $this->msg( 'rev-deleted-event' )->escaped() . '</span>';
946 } elseif( $allLogs ) {
947 $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
948 } else {
949 $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
950 }
951
952 $r .= $this->getLanguage()->getDirMark();
953
954 $queryParams['curid'] = $curId;
955 # Changes message
956 $n = count($block);
957 static $nchanges = array();
958 if ( !isset( $nchanges[$n] ) ) {
959 $nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped();
960 }
961 # Total change link
962 $r .= ' ';
963 $logtext = '';
964 if( !$allLogs ) {
965 if( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
966 $logtext .= $nchanges[$n];
967 } elseif( $isnew ) {
968 $logtext .= $nchanges[$n];
969 } else {
970 $params = $queryParams;
971 $params['diff'] = $currentRevision;
972 $params['oldid'] = $oldid;
973
974 $logtext .= Linker::link(
975 $block[0]->getTitle(),
976 $nchanges[$n],
977 array(),
978 $params,
979 array( 'known', 'noclasses' )
980 );
981 }
982 }
983
984 # History
985 if( $allLogs ) {
986 // don't show history link for logs
987 } elseif( $namehidden || !$block[0]->getTitle()->exists() ) {
988 $logtext .= $this->message['pipe-separator'] . $this->message['hist'];
989 } else {
990 $params = $queryParams;
991 $params['action'] = 'history';
992
993 $logtext .= $this->message['pipe-separator'] .
994 Linker::linkKnown(
995 $block[0]->getTitle(),
996 $this->message['hist'],
997 array(),
998 $params
999 );
1000 }
1001
1002 if( $logtext !== '' ) {
1003 $r .= $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
1004 }
1005
1006 $r .= ' <span class="mw-changeslist-separator">. .</span> ';
1007
1008 # Character difference (does not apply if only log items)
1009 if( $wgRCShowChangedSize && !$allLogs ) {
1010 $last = 0;
1011 $first = count($block) - 1;
1012 # Some events (like logs) have an "empty" size, so we need to skip those...
1013 while( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
1014 $last++;
1015 }
1016 while( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) {
1017 $first--;
1018 }
1019 # Get net change
1020 $chardiff = $this->formatCharacterDifference( $block[$first], $block[$last] );
1021
1022 if( $chardiff == '' ) {
1023 $r .= ' ';
1024 } else {
1025 $r .= ' ' . $chardiff. ' <span class="mw-changeslist-separator">. .</span> ';
1026 }
1027 }
1028
1029 $r .= $users;
1030 $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
1031
1032 # Sub-entries
1033 foreach( $block as $rcObj ) {
1034 # Classes to apply -- TODO implement
1035 $classes = array();
1036 $type = $rcObj->mAttribs['rc_type'];
1037
1038 $r .= '<tr><td></td><td class="mw-enhanced-rc">';
1039 $r .= $this->recentChangesFlags( array(
1040 'newpage' => $type == RC_NEW,
1041 'minor' => $rcObj->mAttribs['rc_minor'],
1042 'unpatrolled' => $rcObj->unpatrolled,
1043 'bot' => $rcObj->mAttribs['rc_bot'],
1044 ) );
1045 $r .= '&#160;</td><td class="mw-enhanced-rc-nested"><span class="mw-enhanced-rc-time">';
1046
1047 $params = $queryParams;
1048
1049 if( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
1050 $params['oldid'] = $rcObj->mAttribs['rc_this_oldid'];
1051 }
1052
1053 # Log timestamp
1054 if( $type == RC_LOG ) {
1055 $link = $rcObj->timestamp;
1056 # Revision link
1057 } elseif( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
1058 $link = '<span class="history-deleted">'.$rcObj->timestamp.'</span> ';
1059 } else {
1060 if ( $rcObj->unpatrolled && $type == RC_NEW) {
1061 $params['rcid'] = $rcObj->mAttribs['rc_id'];
1062 }
1063
1064 $link = Linker::linkKnown(
1065 $rcObj->getTitle(),
1066 $rcObj->timestamp,
1067 array(),
1068 $params
1069 );
1070 if( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
1071 $link = '<span class="history-deleted">'.$link.'</span> ';
1072 }
1073 }
1074 $r .= $link . '</span>';
1075
1076 if ( !$type == RC_LOG || $type == RC_NEW ) {
1077 $r .= ' ' . $this->msg( 'parentheses' )->rawParams( $rcObj->curlink . $this->message['pipe-separator'] . $rcObj->lastlink )->escaped();
1078 }
1079 $r .= ' <span class="mw-changeslist-separator">. .</span> ';
1080
1081 # Character diff
1082 if ( $wgRCShowChangedSize ) {
1083 $cd = $this->formatCharacterDifference( $rcObj );
1084 if ( $cd !== '' ) {
1085 $r .= $cd . ' <span class="mw-changeslist-separator">. .</span> ';
1086 }
1087 }
1088
1089 if ( $rcObj->mAttribs['rc_type'] == RC_LOG ) {
1090 $r .= $this->insertLogEntry( $rcObj );
1091 } else {
1092 # User links
1093 $r .= $rcObj->userlink;
1094 $r .= $rcObj->usertalklink;
1095 $r .= $this->insertComment( $rcObj );
1096 }
1097
1098 # Rollback
1099 $this->insertRollback( $r, $rcObj );
1100 # Tags
1101 $this->insertTags( $r, $rcObj, $classes );
1102
1103 $r .= "</td></tr>\n";
1104 }
1105 $r .= "</table>\n";
1106
1107 $this->rcCacheIndex++;
1108
1109 wfProfileOut( __METHOD__ );
1110
1111 return $r;
1112 }
1113
1114 /**
1115 * Generate HTML for an arrow or placeholder graphic
1116 * @param $dir String: one of '', 'd', 'l', 'r'
1117 * @param $alt String: text
1118 * @param $title String: text
1119 * @return String: HTML "<img>" tag
1120 */
1121 protected function arrow( $dir, $alt='', $title='' ) {
1122 global $wgStylePath;
1123 $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
1124 $encAlt = htmlspecialchars( $alt );
1125 $encTitle = htmlspecialchars( $title );
1126 return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" title=\"$encTitle\" />";
1127 }
1128
1129 /**
1130 * Generate HTML for a right- or left-facing arrow,
1131 * depending on language direction.
1132 * @return String: HTML "<img>" tag
1133 */
1134 protected function sideArrow() {
1135 $dir = $this->getLanguage()->isRTL() ? 'l' : 'r';
1136 return $this->arrow( $dir, '+', $this->msg( 'rc-enhanced-expand' )->text() );
1137 }
1138
1139 /**
1140 * Generate HTML for a down-facing arrow
1141 * depending on language direction.
1142 * @return String: HTML "<img>" tag
1143 */
1144 protected function downArrow() {
1145 return $this->arrow( 'd', '-', $this->msg( 'rc-enhanced-hide' )->text() );
1146 }
1147
1148 /**
1149 * Generate HTML for a spacer image
1150 * @return String: HTML "<img>" tag
1151 */
1152 protected function spacerArrow() {
1153 return $this->arrow( '', codepointToUtf8( 0xa0 ) ); // non-breaking space
1154 }
1155
1156 /**
1157 * Enhanced RC ungrouped line.
1158 *
1159 * @param $rcObj RecentChange
1160 * @return String: a HTML formatted line (generated using $r)
1161 */
1162 protected function recentChangesBlockLine( $rcObj ) {
1163 global $wgRCShowChangedSize;
1164
1165 wfProfileIn( __METHOD__ );
1166 $query['curid'] = $rcObj->mAttribs['rc_cur_id'];
1167
1168 $type = $rcObj->mAttribs['rc_type'];
1169 $logType = $rcObj->mAttribs['rc_log_type'];
1170 $classes = array( 'mw-enhanced-rc' );
1171 if( $logType ) {
1172 # Log entry
1173 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
1174 . $logType . '-' . $rcObj->mAttribs['rc_title'] );
1175 } else {
1176 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
1177 $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
1178 }
1179 $classes[] = $rcObj->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
1180 $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
1181 Html::openElement( 'tr' );
1182
1183 $r .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
1184 # Flag and Timestamp
1185 if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
1186 $r .= '&#160;&#160;&#160;&#160;'; // 4 flags -> 4 spaces
1187 } else {
1188 $r .= $this->recentChangesFlags( array(
1189 'newpage' => $type == RC_NEW,
1190 'minor' => $rcObj->mAttribs['rc_minor'],
1191 'unpatrolled' => $rcObj->unpatrolled,
1192 'bot' => $rcObj->mAttribs['rc_bot'],
1193 ) );
1194 }
1195 $r .= '&#160;'.$rcObj->timestamp.'&#160;</td><td>';
1196 # Article or log link
1197 if( $logType ) {
1198 $logPage = new LogPage( $logType );
1199 $logTitle = SpecialPage::getTitleFor( 'Log', $logType );
1200 $logName = $logPage->getName()->escaped();
1201 $r .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logTitle, $logName ) )->escaped();
1202 } else {
1203 $this->insertArticleLink( $r, $rcObj, $rcObj->unpatrolled, $rcObj->watched );
1204 }
1205 # Diff and hist links
1206 if ( $type != RC_LOG ) {
1207 $query['action'] = 'history';
1208 $r .= ' ' . $this->msg( 'parentheses' )->rawParams( $rcObj->difflink . $this->message['pipe-separator'] . Linker::linkKnown(
1209 $rcObj->getTitle(),
1210 $this->message['hist'],
1211 array(),
1212 $query
1213 ) )->escaped();
1214 }
1215 $r .= ' <span class="mw-changeslist-separator">. .</span> ';
1216 # Character diff
1217 if ( $wgRCShowChangedSize ) {
1218 $cd = $this->formatCharacterDifference( $rcObj );
1219 if ( $cd !== '' ) {
1220 $r .= $cd . ' <span class="mw-changeslist-separator">. .</span> ';
1221 }
1222 }
1223
1224 if ( $type == RC_LOG ) {
1225 $r .= $this->insertLogEntry( $rcObj );
1226 } else {
1227 $r .= ' '.$rcObj->userlink . $rcObj->usertalklink;
1228 $r .= $this->insertComment( $rcObj );
1229 $this->insertRollback( $r, $rcObj );
1230 }
1231
1232 # Tags
1233 $this->insertTags( $r, $rcObj, $classes );
1234 # Show how many people are watching this if enabled
1235 $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
1236
1237 $r .= "</td></tr></table>\n";
1238
1239 wfProfileOut( __METHOD__ );
1240
1241 return $r;
1242 }
1243
1244 /**
1245 * If enhanced RC is in use, this function takes the previously cached
1246 * RC lines, arranges them, and outputs the HTML
1247 *
1248 * @return string
1249 */
1250 protected function recentChangesBlock() {
1251 if( count ( $this->rc_cache ) == 0 ) {
1252 return '';
1253 }
1254
1255 wfProfileIn( __METHOD__ );
1256
1257 $blockOut = '';
1258 foreach( $this->rc_cache as $block ) {
1259 if( count( $block ) < 2 ) {
1260 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
1261 } else {
1262 $blockOut .= $this->recentChangesBlockGroup( $block );
1263 }
1264 }
1265
1266 wfProfileOut( __METHOD__ );
1267
1268 return '<div>'.$blockOut.'</div>';
1269 }
1270
1271 /**
1272 * Returns text for the end of RC
1273 * If enhanced RC is in use, returns pretty much all the text
1274 * @return string
1275 */
1276 public function endRecentChangesList() {
1277 return $this->recentChangesBlock() . parent::endRecentChangesList();
1278 }
1279
1280 }