Merge "Add tests for WikiMap and WikiReference"
[lhc/web/wiklou.git] / includes / changes / EnhancedChangesList.php
1 <?php
2 /**
3 * Generates a list of changes using an Enhanced system (uses javascript).
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 */
22
23 class EnhancedChangesList extends ChangesList {
24
25 /**
26 * @var RCCacheEntryFactory
27 */
28 protected $cacheEntryFactory;
29
30 /**
31 * @var array Array of array of RCCacheEntry
32 */
33 protected $rc_cache;
34
35 /**
36 * @param IContextSource|Skin $obj
37 * @throws MWException
38 */
39 public function __construct( $obj ) {
40 if ( $obj instanceof Skin ) {
41 // @todo: deprecate constructing with Skin
42 $context = $obj->getContext();
43 } else {
44 if ( !$obj instanceof IContextSource ) {
45 throw new MWException( 'EnhancedChangesList must be constructed with a '
46 . 'context source or skin.' );
47 }
48
49 $context = $obj;
50 }
51
52 parent::__construct( $context );
53
54 // message is set by the parent ChangesList class
55 $this->cacheEntryFactory = new RCCacheEntryFactory(
56 $context,
57 $this->message
58 );
59 }
60
61 /**
62 * Add the JavaScript file for enhanced changeslist
63 * @return string
64 */
65 public function beginRecentChangesList() {
66 $this->rc_cache = array();
67 $this->rcMoveIndex = 0;
68 $this->rcCacheIndex = 0;
69 $this->lastdate = '';
70 $this->rclistOpen = false;
71 $this->getOutput()->addModuleStyles( array(
72 'mediawiki.special.changeslist',
73 'mediawiki.special.changeslist.enhanced',
74 ) );
75 $this->getOutput()->addModules( array(
76 'jquery.makeCollapsible',
77 'mediawiki.icon',
78 ) );
79
80 return '<div class="mw-changeslist">';
81 }
82
83 /**
84 * Format a line for enhanced recentchange (aka with javascript and block of lines).
85 *
86 * @param RecentChange $baseRC
87 * @param bool $watched
88 *
89 * @return string
90 */
91 public function recentChangesLine( &$baseRC, $watched = false ) {
92
93 $date = $this->getLanguage()->userDate(
94 $baseRC->mAttribs['rc_timestamp'],
95 $this->getUser()
96 );
97
98 $ret = '';
99
100 # If it's a new day, add the headline and flush the cache
101 if ( $date != $this->lastdate ) {
102 # Process current cache
103 $ret = $this->recentChangesBlock();
104 $this->rc_cache = array();
105 $ret .= Xml::element( 'h4', null, $date ) . "\n";
106 $this->lastdate = $date;
107 }
108
109 $cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $baseRC, $watched );
110 $this->addCacheEntry( $cacheEntry );
111
112 return $ret;
113 }
114
115 /**
116 * Put accumulated information into the cache, for later display.
117 * Page moves go on their own line.
118 *
119 * @param RCCacheEntry $cacheEntry
120 */
121 protected function addCacheEntry( RCCacheEntry $cacheEntry ) {
122 $cacheGroupingKey = $this->makeCacheGroupingKey( $cacheEntry );
123
124 if ( !isset( $this->rc_cache[$cacheGroupingKey] ) ) {
125 $this->rc_cache[$cacheGroupingKey] = array();
126 }
127
128 array_push( $this->rc_cache[$cacheGroupingKey], $cacheEntry );
129 }
130
131 /**
132 * @todo use rc_source to group, if set; fallback to rc_type
133 *
134 * @param RCCacheEntry $cacheEntry
135 *
136 * @return string
137 */
138 protected function makeCacheGroupingKey( RCCacheEntry $cacheEntry ) {
139 $title = $cacheEntry->getTitle();
140 $cacheGroupingKey = $title->getPrefixedDBkey();
141
142 $type = $cacheEntry->mAttribs['rc_type'];
143
144 if ( $type == RC_LOG ) {
145 // Group by log type
146 $cacheGroupingKey = SpecialPage::getTitleFor(
147 'Log',
148 $cacheEntry->mAttribs['rc_log_type']
149 )->getPrefixedDBkey();
150 }
151
152 return $cacheGroupingKey;
153 }
154
155 /**
156 * Enhanced RC group
157 * @param RCCacheEntry[] $block
158 * @return string
159 */
160 protected function recentChangesBlockGroup( $block ) {
161
162 # Add the namespace and title of the block as part of the class
163 $classes = array( 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc' );
164 if ( $block[0]->mAttribs['rc_log_type'] ) {
165 # Log entry
166 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
167 . $block[0]->mAttribs['rc_log_type'] );
168 } else {
169 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
170 . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
171 }
172 $classes[] = $block[0]->watched && $block[0]->mAttribs['rc_timestamp'] >= $block[0]->watched
173 ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
174 $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
175 Html::openElement( 'tr' );
176
177 # Collate list of users
178 $userlinks = array();
179 # Other properties
180 $unpatrolled = false;
181 $isnew = false;
182 $allBots = true;
183 $allMinors = true;
184 $curId = 0;
185 # Some catalyst variables...
186 $namehidden = true;
187 $allLogs = true;
188 $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
189 foreach ( $block as $rcObj ) {
190 if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
191 $isnew = true;
192 }
193 // If all log actions to this page were hidden, then don't
194 // give the name of the affected page for this block!
195 if ( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
196 $namehidden = false;
197 }
198 $u = $rcObj->userlink;
199 if ( !isset( $userlinks[$u] ) ) {
200 $userlinks[$u] = 0;
201 }
202 if ( $rcObj->unpatrolled ) {
203 $unpatrolled = true;
204 }
205 if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
206 $allLogs = false;
207 }
208 # Get the latest entry with a page_id and oldid
209 # since logs may not have these.
210 if ( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
211 $curId = $rcObj->mAttribs['rc_cur_id'];
212 }
213
214 if ( !$rcObj->mAttribs['rc_bot'] ) {
215 $allBots = false;
216 }
217 if ( !$rcObj->mAttribs['rc_minor'] ) {
218 $allMinors = false;
219 }
220
221 $userlinks[$u]++;
222 }
223
224 # Sort the list and convert to text
225 krsort( $userlinks );
226 asort( $userlinks );
227 $users = array();
228 foreach ( $userlinks as $userlink => $count ) {
229 $text = $userlink;
230 $text .= $this->getLanguage()->getDirMark();
231 if ( $count > 1 ) {
232 // @todo FIXME: Hardcoded '×'. Should be a message.
233 $formattedCount = $this->getLanguage()->formatNum( $count ) . '×';
234 $text .= ' ' . $this->msg( 'parentheses' )->rawParams( $formattedCount )->escaped();
235 }
236 array_push( $users, $text );
237 }
238
239 $users = ' <span class="changedby">'
240 . $this->msg( 'brackets' )->rawParams(
241 implode( $this->message['semicolon-separator'], $users )
242 )->escaped() . '</span>';
243
244 $tl = '<span class="mw-collapsible-toggle mw-collapsible-arrow ' .
245 'mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
246 $r .= "<td>$tl</td>";
247
248 # Main line
249 $r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags( array(
250 'newpage' => $isnew, # show, when one have this flag
251 'minor' => $allMinors, # show only, when all have this flag
252 'unpatrolled' => $unpatrolled, # show, when one have this flag
253 'bot' => $allBots, # show only, when all have this flag
254 ) );
255
256 # Timestamp
257 $r .= '&#160;' . $block[0]->timestamp . '&#160;</td><td>';
258
259 # Article link
260 if ( $namehidden ) {
261 $r .= ' <span class="history-deleted">' .
262 $this->msg( 'rev-deleted-event' )->escaped() . '</span>';
263 } elseif ( $allLogs ) {
264 $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
265 } else {
266 $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
267 }
268
269 $r .= $this->getLanguage()->getDirMark();
270
271 $queryParams['curid'] = $curId;
272
273 # Sub-entries
274 $lines = '';
275 foreach ( $block as $i => $rcObj ) {
276 $line = $this->getLineData( $block, $rcObj, $queryParams );
277 $lines .= $line;
278 if ( !$line ) {
279 // completely ignore this RC entry if we don't want to render it
280 unset( $block[$i] );
281 }
282 }
283
284 $r .= $this->getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden );
285
286 $r .= ' <span class="mw-changeslist-separator">. .</span> ';
287
288 # Character difference (does not apply if only log items)
289 if ( $RCShowChangedSize && !$allLogs ) {
290 $last = 0;
291 $first = count( $block ) - 1;
292 # Some events (like logs) have an "empty" size, so we need to skip those...
293 while ( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
294 $last++;
295 }
296 while ( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) {
297 $first--;
298 }
299 # Get net change
300 $chardiff = $this->formatCharacterDifference( $block[$first], $block[$last] );
301
302 if ( $chardiff == '' ) {
303 $r .= ' ';
304 } else {
305 $r .= ' ' . $chardiff . ' <span class="mw-changeslist-separator">. .</span> ';
306 }
307 }
308
309 $r .= $users;
310 $r .= $this->numberofWatchingusers( $block[0]->numberofWatchingusers );
311 $r .= '</td></tr>';
312
313 if ( !$lines ) {
314 // if there are no lines to be rendered (all aborted by hook), don't render the block
315 return '';
316 }
317
318 $r .= $lines;
319 $r .= "</table>\n";
320
321 $this->rcCacheIndex++;
322
323 return $r;
324 }
325
326 /**
327 * @param RCCacheEntry[] $block
328 * @param RCCacheEntry $rcObj
329 * @param array $queryParams
330 * @return string
331 * @throws Exception
332 * @throws FatalError
333 * @throws MWException
334 */
335 protected function getLineData( array $block, RCCacheEntry $rcObj, array $queryParams = array() ) {
336 $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
337
338 # Classes to apply -- TODO implement
339 $classes = array();
340 $type = $rcObj->mAttribs['rc_type'];
341 $data = array();
342
343 $trClass = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
344 ? ' class="mw-enhanced-watched"' : '';
345 $separator = ' <span class="mw-changeslist-separator">. .</span> ';
346
347 $data['recentChangesFlags'] = array(
348 'newpage' => $type == RC_NEW,
349 'minor' => $rcObj->mAttribs['rc_minor'],
350 'unpatrolled' => $rcObj->unpatrolled,
351 'bot' => $rcObj->mAttribs['rc_bot'],
352 );
353
354 $params = $queryParams;
355
356 if ( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
357 $params['oldid'] = $rcObj->mAttribs['rc_this_oldid'];
358 }
359
360 # Log timestamp
361 if ( $type == RC_LOG ) {
362 $link = $rcObj->timestamp;
363 # Revision link
364 } elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
365 $link = '<span class="history-deleted">' . $rcObj->timestamp . '</span> ';
366 } else {
367 $link = Linker::linkKnown(
368 $rcObj->getTitle(),
369 $rcObj->timestamp,
370 array(),
371 $params
372 );
373 if ( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
374 $link = '<span class="history-deleted">' . $link . '</span> ';
375 }
376 }
377 $data['timestampLink'] = $link;
378
379 $currentAndLastLinks = '';
380 if ( !$type == RC_LOG || $type == RC_NEW ) {
381 $currentAndLastLinks .= ' ' . $this->msg( 'parentheses' )->rawParams(
382 $rcObj->curlink .
383 $this->message['pipe-separator'] .
384 $rcObj->lastlink
385 )->escaped();
386 }
387 $data['currentAndLastLinks'] = $currentAndLastLinks;
388 $data['separatorAfterCurrentAndLastLinks'] = $separator;
389
390 # Character diff
391 if ( $RCShowChangedSize ) {
392 $cd = $this->formatCharacterDifference( $rcObj );
393 if ( $cd !== '' ) {
394 $data['characterDiff'] = $cd;
395 $data['separatorAfterCharacterDiff'] = $separator;
396 }
397 }
398
399 if ( $rcObj->mAttribs['rc_type'] == RC_LOG ) {
400 $data['logEntry'] = $this->insertLogEntry( $rcObj );
401 } else {
402 # User links
403 $data['userLink'] = $rcObj->userlink;
404 $data['userTalkLink'] = $rcObj->usertalklink;
405 $data['comment'] = $this->insertComment( $rcObj );
406 }
407
408 # Rollback
409 $data['rollback'] = $this->getRollback( $rcObj );
410
411 # Tags
412 $data['tags'] = $this->getTags( $rcObj, $classes );
413
414 // give the hook a chance to modify the data
415 $success = Hooks::run( 'EnhancedChangesListModifyLineData',
416 array( $this, &$data, $block, $rcObj ) );
417 if ( !$success ) {
418 // skip entry if hook aborted it
419 return '';
420 }
421
422 $line = '<tr' . $trClass . '><td></td><td class="mw-enhanced-rc">';
423 if ( isset( $data['recentChangesFlags'] ) ) {
424 $line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
425 unset( $data['recentChangesFlags'] );
426 }
427 $line .= '&#160;</td><td class="mw-enhanced-rc-nested">';
428
429 if ( isset( $data['timestampLink'] ) ) {
430 $line .= '<span class="mw-enhanced-rc-time">' . $data['timestampLink'] . '</span>';
431 unset( $data['timestampLink'] );
432 }
433
434 // everything else: makes it easier for extensions to add or remove data
435 $line .= implode( '', $data );
436
437 $line .= "</td></tr>\n";
438
439 return $line;
440 }
441
442 /**
443 * Generates amount of changes (linking to diff ) & link to history.
444 *
445 * @param array $block
446 * @param array $queryParams
447 * @param bool $allLogs
448 * @param bool $isnew
449 * @param bool $namehidden
450 * @return string
451 */
452 protected function getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ) {
453 # Changes message
454 static $nchanges = array();
455 static $sinceLastVisitMsg = array();
456
457 $n = count( $block );
458 if ( !isset( $nchanges[$n] ) ) {
459 $nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped();
460 }
461
462 $sinceLast = 0;
463 $unvisitedOldid = null;
464 /** @var $rcObj RCCacheEntry */
465 foreach ( $block as $rcObj ) {
466 // Same logic as below inside main foreach
467 if ( $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched ) {
468 $sinceLast++;
469 $unvisitedOldid = $rcObj->mAttribs['rc_last_oldid'];
470 }
471 }
472 if ( !isset( $sinceLastVisitMsg[$sinceLast] ) ) {
473 $sinceLastVisitMsg[$sinceLast] =
474 $this->msg( 'enhancedrc-since-last-visit' )->numParams( $sinceLast )->escaped();
475 }
476
477 $currentRevision = 0;
478 foreach ( $block as $rcObj ) {
479 if ( !$currentRevision ) {
480 $currentRevision = $rcObj->mAttribs['rc_this_oldid'];
481 }
482 }
483
484 # Total change link
485 $links = array();
486 /** @var $block0 RecentChange */
487 $block0 = $block[0];
488 $last = $block[count( $block ) - 1];
489 if ( !$allLogs ) {
490 if ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
491 $links['total-changes'] = $nchanges[$n];
492 } elseif ( $isnew ) {
493 $links['total-changes'] = $nchanges[$n];
494 } else {
495 $links['total-changes'] = Linker::link(
496 $block0->getTitle(),
497 $nchanges[$n],
498 array(),
499 $queryParams + array(
500 'diff' => $currentRevision,
501 'oldid' => $last->mAttribs['rc_last_oldid'],
502 ),
503 array( 'known', 'noclasses' )
504 );
505 if ( $sinceLast > 0 && $sinceLast < $n ) {
506 $links['total-changes-since-last'] = Linker::link(
507 $block0->getTitle(),
508 $sinceLastVisitMsg[$sinceLast],
509 array(),
510 $queryParams + array(
511 'diff' => $currentRevision,
512 'oldid' => $unvisitedOldid,
513 ),
514 array( 'known', 'noclasses' )
515 );
516 }
517 }
518 }
519
520 # History
521 if ( $allLogs ) {
522 // don't show history link for logs
523 } elseif ( $namehidden || !$block0->getTitle()->exists() ) {
524 $links['history'] = $this->message['enhancedrc-history'];
525 } else {
526 $params = $queryParams;
527 $params['action'] = 'history';
528
529 $links['history'] = Linker::linkKnown(
530 $block0->getTitle(),
531 $this->message['enhancedrc-history'],
532 array(),
533 $params
534 );
535 }
536
537 # Allow others to alter, remove or add to these links
538 Hooks::run( 'EnhancedChangesList::getLogText',
539 array( $this, &$links, $block ) );
540
541 if ( !$links ) {
542 return '';
543 }
544
545 $logtext = implode( $this->message['pipe-separator'], $links );
546 $logtext = $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
547 return ' ' . $logtext;
548 }
549
550 /**
551 * Enhanced RC ungrouped line.
552 *
553 * @param RecentChange|RCCacheEntry $rcObj
554 * @return string A HTML formatted line (generated using $r)
555 */
556 protected function recentChangesBlockLine( $rcObj ) {
557 $data = array();
558
559 $query['curid'] = $rcObj->mAttribs['rc_cur_id'];
560
561 $type = $rcObj->mAttribs['rc_type'];
562 $logType = $rcObj->mAttribs['rc_log_type'];
563 $classes = array( 'mw-enhanced-rc' );
564 if ( $logType ) {
565 # Log entry
566 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-' . $logType );
567 } else {
568 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
569 $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
570 }
571 $classes[] = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
572 ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
573
574 # Flag and Timestamp
575 $data['recentChangesFlags'] = array(
576 'newpage' => $type == RC_NEW,
577 'minor' => $rcObj->mAttribs['rc_minor'],
578 'unpatrolled' => $rcObj->unpatrolled,
579 'bot' => $rcObj->mAttribs['rc_bot'],
580 );
581 // timestamp is not really a link here, but is called timestampLink
582 // for consistency with EnhancedChangesListModifyLineData
583 $data['timestampLink'] = $rcObj->timestamp;
584
585 # Article or log link
586 if ( $logType ) {
587 $logPage = new LogPage( $logType );
588 $logTitle = SpecialPage::getTitleFor( 'Log', $logType );
589 $logName = $logPage->getName()->escaped();
590 $data['logLink'] = $this->msg( 'parentheses' )
591 ->rawParams( Linker::linkKnown( $logTitle, $logName ) )->escaped();
592 } else {
593 $data['articleLink'] = $this->getArticleLink( $rcObj, $rcObj->unpatrolled, $rcObj->watched );
594 }
595
596 # Diff and hist links
597 if ( $type != RC_LOG ) {
598 $query['action'] = 'history';
599 $data['historyLink'] = ' ' . $this->msg( 'parentheses' )
600 ->rawParams( $rcObj->difflink . $this->message['pipe-separator'] . Linker::linkKnown(
601 $rcObj->getTitle(),
602 $this->message['hist'],
603 array(),
604 $query
605 ) )->escaped();
606 }
607 $data['separatorAfterLinks'] = ' <span class="mw-changeslist-separator">. .</span> ';
608
609 # Character diff
610 if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
611 $cd = $this->formatCharacterDifference( $rcObj );
612 if ( $cd !== '' ) {
613 $data['characterDiff'] = $cd;
614 $data['separatorAftercharacterDiff'] = ' <span class="mw-changeslist-separator">. .</span> ';
615 }
616 }
617
618 if ( $type == RC_LOG ) {
619 $data['logEntry'] = $this->insertLogEntry( $rcObj );
620 } else {
621 $data['userLink'] = $rcObj->userlink;
622 $data['userTalkLink'] = $rcObj->usertalklink;
623 $data['comment'] = $this->insertComment( $rcObj );
624 $data['rollback'] = $this->getRollback( $rcObj );
625 }
626
627 # Tags
628 $data['tags'] = $this->getTags( $rcObj, $classes );
629
630 # Show how many people are watching this if enabled
631 $data['watchingUsers'] = $this->numberofWatchingusers( $rcObj->numberofWatchingusers );
632
633 // give the hook a chance to modify the data
634 $success = Hooks::run( 'EnhancedChangesListModifyBlockLineData',
635 array( $this, &$data, $rcObj ) );
636 if ( !$success ) {
637 // skip entry if hook aborted it
638 return '';
639 }
640
641 $line = Html::openElement( 'table', array( 'class' => $classes ) ) .
642 Html::openElement( 'tr' );
643 $line .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow-space"></span>';
644
645 if ( isset( $data['recentChangesFlags'] ) ) {
646 $line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
647 unset( $data['recentChangesFlags'] );
648 }
649
650 if ( isset( $data['timestampLink'] ) ) {
651 $line .= '&#160;' . $data['timestampLink'];
652 unset( $data['timestampLink'] );
653 }
654 $line .= '&#160;</td><td>';
655
656 // everything else: makes it easier for extensions to add or remove data
657 $line .= implode( '', $data );
658
659 $line .= "</td></tr></table>\n";
660
661 return $line;
662 }
663
664 /**
665 * If enhanced RC is in use, this function takes the previously cached
666 * RC lines, arranges them, and outputs the HTML
667 *
668 * @return string
669 */
670 protected function recentChangesBlock() {
671 if ( count( $this->rc_cache ) == 0 ) {
672 return '';
673 }
674
675 $blockOut = '';
676 foreach ( $this->rc_cache as $block ) {
677 if ( count( $block ) < 2 ) {
678 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
679 } else {
680 $blockOut .= $this->recentChangesBlockGroup( $block );
681 }
682 }
683
684 return '<div>' . $blockOut . '</div>';
685 }
686
687 /**
688 * Returns text for the end of RC
689 * If enhanced RC is in use, returns pretty much all the text
690 * @return string
691 */
692 public function endRecentChangesList() {
693 return $this->recentChangesBlock() . '</div>';
694 }
695 }