Additional release note for I495683
[mediawiki.git] / includes / changes / EnhancedChangesList.php
blob088398278ae8a5fd654540d3f3dd92c8ca94343e
1 <?php
2 /**
3 * Generates a list of changes using an Enhanced system (uses javascript).
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
20 * @file
23 class EnhancedChangesList extends ChangesList {
25 /**
26 * @var RCCacheEntryFactory
28 protected $cacheEntryFactory;
30 /**
31 * @var array Array of array of RCCacheEntry
33 protected $rc_cache;
35 /**
36 * @param IContextSource|Skin $obj
37 * @throws MWException
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.' );
49 $context = $obj;
52 parent::__construct( $context );
54 // message is set by the parent ChangesList class
55 $this->cacheEntryFactory = new RCCacheEntryFactory(
56 $context,
57 $this->message
61 /**
62 * Add the JavaScript file for enhanced changeslist
63 * @return string
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 ) );
80 return '<div class="mw-changeslist">';
83 /**
84 * Format a line for enhanced recentchange (aka with javascript and block of lines).
86 * @param RecentChange $rc
87 * @param bool $watched
88 * @param int $linenumber (default null)
90 * @return string
92 public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
94 $date = $this->getLanguage()->userDate(
95 $rc->mAttribs['rc_timestamp'],
96 $this->getUser()
99 $ret = '';
101 # If it's a new day, add the headline and flush the cache
102 if ( $date != $this->lastdate ) {
103 # Process current cache
104 $ret = $this->recentChangesBlock();
105 $this->rc_cache = array();
106 $ret .= Xml::element( 'h4', null, $date ) . "\n";
107 $this->lastdate = $date;
110 $cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $rc, $watched );
111 $this->addCacheEntry( $cacheEntry );
113 return $ret;
117 * Put accumulated information into the cache, for later display.
118 * Page moves go on their own line.
120 * @param RCCacheEntry $cacheEntry
122 protected function addCacheEntry( RCCacheEntry $cacheEntry ) {
123 $cacheGroupingKey = $this->makeCacheGroupingKey( $cacheEntry );
125 if ( !isset( $this->rc_cache[$cacheGroupingKey] ) ) {
126 $this->rc_cache[$cacheGroupingKey] = array();
129 array_push( $this->rc_cache[$cacheGroupingKey], $cacheEntry );
133 * @todo use rc_source to group, if set; fallback to rc_type
135 * @param RCCacheEntry $cacheEntry
137 * @return string
139 protected function makeCacheGroupingKey( RCCacheEntry $cacheEntry ) {
140 $title = $cacheEntry->getTitle();
141 $cacheGroupingKey = $title->getPrefixedDBkey();
143 $type = $cacheEntry->mAttribs['rc_type'];
145 if ( $type == RC_LOG ) {
146 // Group by log type
147 $cacheGroupingKey = SpecialPage::getTitleFor(
148 'Log',
149 $cacheEntry->mAttribs['rc_log_type']
150 )->getPrefixedDBkey();
153 return $cacheGroupingKey;
157 * Enhanced RC group
158 * @param RCCacheEntry[] $block
159 * @return string
161 protected function recentChangesBlockGroup( $block ) {
163 # Add the namespace and title of the block as part of the class
164 $classes = array( 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc' );
165 if ( $block[0]->mAttribs['rc_log_type'] ) {
166 # Log entry
167 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
168 . $block[0]->mAttribs['rc_log_type'] );
169 } else {
170 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
171 . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
173 $classes[] = $block[0]->watched && $block[0]->mAttribs['rc_timestamp'] >= $block[0]->watched
174 ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
175 $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
176 Html::openElement( 'tr' );
178 # Collate list of users
179 $userlinks = array();
180 # Other properties
181 $unpatrolled = false;
182 $isnew = false;
183 $allBots = true;
184 $allMinors = true;
185 $curId = 0;
186 # Some catalyst variables...
187 $namehidden = true;
188 $allLogs = true;
189 $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
190 foreach ( $block as $rcObj ) {
191 if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
192 $isnew = true;
194 // If all log actions to this page were hidden, then don't
195 // give the name of the affected page for this block!
196 if ( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
197 $namehidden = false;
199 $u = $rcObj->userlink;
200 if ( !isset( $userlinks[$u] ) ) {
201 $userlinks[$u] = 0;
203 if ( $rcObj->unpatrolled ) {
204 $unpatrolled = true;
206 if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
207 $allLogs = false;
209 # Get the latest entry with a page_id and oldid
210 # since logs may not have these.
211 if ( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
212 $curId = $rcObj->mAttribs['rc_cur_id'];
215 if ( !$rcObj->mAttribs['rc_bot'] ) {
216 $allBots = false;
218 if ( !$rcObj->mAttribs['rc_minor'] ) {
219 $allMinors = false;
222 $userlinks[$u]++;
225 # Sort the list and convert to text
226 krsort( $userlinks );
227 asort( $userlinks );
228 $users = array();
229 foreach ( $userlinks as $userlink => $count ) {
230 $text = $userlink;
231 $text .= $this->getLanguage()->getDirMark();
232 if ( $count > 1 ) {
233 // @todo FIXME: Hardcoded '×'. Should be a message.
234 $formattedCount = $this->getLanguage()->formatNum( $count ) . '×';
235 $text .= ' ' . $this->msg( 'parentheses' )->rawParams( $formattedCount )->escaped();
237 array_push( $users, $text );
240 $users = ' <span class="changedby">'
241 . $this->msg( 'brackets' )->rawParams(
242 implode( $this->message['semicolon-separator'], $users )
243 )->escaped() . '</span>';
245 $tl = '<span class="mw-collapsible-toggle mw-collapsible-arrow ' .
246 'mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
247 $r .= "<td>$tl</td>";
249 # Main line
250 $r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags( array(
251 'newpage' => $isnew, # show, when one have this flag
252 'minor' => $allMinors, # show only, when all have this flag
253 'unpatrolled' => $unpatrolled, # show, when one have this flag
254 'bot' => $allBots, # show only, when all have this flag
255 ) );
257 # Timestamp
258 $r .= '&#160;' . $block[0]->timestamp . '&#160;</td><td>';
260 # Article link
261 if ( $namehidden ) {
262 $r .= ' <span class="history-deleted">' .
263 $this->msg( 'rev-deleted-event' )->escaped() . '</span>';
264 } elseif ( $allLogs ) {
265 $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
266 } else {
267 $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
270 $r .= $this->getLanguage()->getDirMark();
272 $queryParams['curid'] = $curId;
274 # Sub-entries
275 $lines = '';
276 foreach ( $block as $i => $rcObj ) {
277 $line = $this->getLineData( $block, $rcObj, $queryParams );
278 $lines .= $line;
279 if ( !$line ) {
280 // completely ignore this RC entry if we don't want to render it
281 unset( $block[$i] );
284 // Further down are some assumptions that $block is a 0-indexed array
285 // with (count-1) as last key. Let's make sure it is.
286 $block = array_values( $block );
287 if ( empty( $block ) ) {
288 // if we can't show anything, don't display this block altogether
289 return '';
292 $r .= $this->getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden );
294 $r .= ' <span class="mw-changeslist-separator">. .</span> ';
296 # Character difference (does not apply if only log items)
297 if ( $RCShowChangedSize && !$allLogs ) {
298 $last = 0;
299 $first = count( $block ) - 1;
300 # Some events (like logs) have an "empty" size, so we need to skip those...
301 while ( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
302 $last++;
304 while ( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) {
305 $first--;
307 # Get net change
308 $chardiff = $this->formatCharacterDifference( $block[$first], $block[$last] );
310 if ( $chardiff == '' ) {
311 $r .= ' ';
312 } else {
313 $r .= ' ' . $chardiff . ' <span class="mw-changeslist-separator">. .</span> ';
317 $r .= $users;
318 $r .= $this->numberofWatchingusers( $block[0]->numberofWatchingusers );
319 $r .= '</td></tr>';
321 if ( !$lines ) {
322 // if there are no lines to be rendered (all aborted by hook), don't render the block
323 return '';
326 $r .= $lines;
327 $r .= "</table>\n";
329 $this->rcCacheIndex++;
331 return $r;
335 * @param RCCacheEntry[] $block
336 * @param RCCacheEntry $rcObj
337 * @param array $queryParams
338 * @return string
339 * @throws Exception
340 * @throws FatalError
341 * @throws MWException
343 protected function getLineData( array $block, RCCacheEntry $rcObj, array $queryParams = array() ) {
344 $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
346 # Classes to apply -- TODO implement
347 $classes = array();
348 $type = $rcObj->mAttribs['rc_type'];
349 $data = array();
351 $trClass = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
352 ? ' class="mw-enhanced-watched"' : '';
353 $separator = ' <span class="mw-changeslist-separator">. .</span> ';
355 $data['recentChangesFlags'] = array(
356 'newpage' => $type == RC_NEW,
357 'minor' => $rcObj->mAttribs['rc_minor'],
358 'unpatrolled' => $rcObj->unpatrolled,
359 'bot' => $rcObj->mAttribs['rc_bot'],
362 $params = $queryParams;
364 if ( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
365 $params['oldid'] = $rcObj->mAttribs['rc_this_oldid'];
368 # Log timestamp
369 if ( $type == RC_LOG ) {
370 $link = $rcObj->timestamp;
371 # Revision link
372 } elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
373 $link = '<span class="history-deleted">' . $rcObj->timestamp . '</span> ';
374 } else {
375 $link = Linker::linkKnown(
376 $rcObj->getTitle(),
377 $rcObj->timestamp,
378 array(),
379 $params
381 if ( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
382 $link = '<span class="history-deleted">' . $link . '</span> ';
385 $data['timestampLink'] = $link;
387 $currentAndLastLinks = '';
388 if ( !$type == RC_LOG || $type == RC_NEW ) {
389 $currentAndLastLinks .= ' ' . $this->msg( 'parentheses' )->rawParams(
390 $rcObj->curlink .
391 $this->message['pipe-separator'] .
392 $rcObj->lastlink
393 )->escaped();
395 $data['currentAndLastLinks'] = $currentAndLastLinks;
396 $data['separatorAfterCurrentAndLastLinks'] = $separator;
398 # Character diff
399 if ( $RCShowChangedSize ) {
400 $cd = $this->formatCharacterDifference( $rcObj );
401 if ( $cd !== '' ) {
402 $data['characterDiff'] = $cd;
403 $data['separatorAfterCharacterDiff'] = $separator;
407 if ( $rcObj->mAttribs['rc_type'] == RC_LOG ) {
408 $data['logEntry'] = $this->insertLogEntry( $rcObj );
409 } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
410 $data['comment'] = $this->insertComment( $rcObj );
411 } else {
412 # User links
413 $data['userLink'] = $rcObj->userlink;
414 $data['userTalkLink'] = $rcObj->usertalklink;
415 $data['comment'] = $this->insertComment( $rcObj );
418 # Rollback
419 $data['rollback'] = $this->getRollback( $rcObj );
421 # Tags
422 $data['tags'] = $this->getTags( $rcObj, $classes );
424 // give the hook a chance to modify the data
425 $success = Hooks::run( 'EnhancedChangesListModifyLineData',
426 array( $this, &$data, $block, $rcObj ) );
427 if ( !$success ) {
428 // skip entry if hook aborted it
429 return '';
432 $line = '<tr' . $trClass . '><td></td><td class="mw-enhanced-rc">';
433 if ( isset( $data['recentChangesFlags'] ) ) {
434 $line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
435 unset( $data['recentChangesFlags'] );
437 $line .= '&#160;</td><td class="mw-enhanced-rc-nested">';
439 if ( isset( $data['timestampLink'] ) ) {
440 $line .= '<span class="mw-enhanced-rc-time">' . $data['timestampLink'] . '</span>';
441 unset( $data['timestampLink'] );
444 // everything else: makes it easier for extensions to add or remove data
445 $line .= implode( '', $data );
447 $line .= "</td></tr>\n";
449 return $line;
453 * Generates amount of changes (linking to diff ) & link to history.
455 * @param array $block
456 * @param array $queryParams
457 * @param bool $allLogs
458 * @param bool $isnew
459 * @param bool $namehidden
460 * @return string
462 protected function getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ) {
463 if ( empty( $block ) ) {
464 return '';
467 # Changes message
468 static $nchanges = array();
469 static $sinceLastVisitMsg = array();
471 $n = count( $block );
472 if ( !isset( $nchanges[$n] ) ) {
473 $nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped();
476 $sinceLast = 0;
477 $unvisitedOldid = null;
478 /** @var $rcObj RCCacheEntry */
479 foreach ( $block as $rcObj ) {
480 // Same logic as below inside main foreach
481 if ( $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched ) {
482 $sinceLast++;
483 $unvisitedOldid = $rcObj->mAttribs['rc_last_oldid'];
486 if ( !isset( $sinceLastVisitMsg[$sinceLast] ) ) {
487 $sinceLastVisitMsg[$sinceLast] =
488 $this->msg( 'enhancedrc-since-last-visit' )->numParams( $sinceLast )->escaped();
491 $currentRevision = 0;
492 foreach ( $block as $rcObj ) {
493 if ( !$currentRevision ) {
494 $currentRevision = $rcObj->mAttribs['rc_this_oldid'];
498 # Total change link
499 $links = array();
500 /** @var $block0 RecentChange */
501 $block0 = $block[0];
502 $last = $block[count( $block ) - 1];
503 if ( !$allLogs && $rcObj->mAttribs['rc_type'] != RC_CATEGORIZE ) {
504 if ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
505 $links['total-changes'] = $nchanges[$n];
506 } elseif ( $isnew ) {
507 $links['total-changes'] = $nchanges[$n];
508 } else {
509 $links['total-changes'] = Linker::link(
510 $block0->getTitle(),
511 $nchanges[$n],
512 array(),
513 $queryParams + array(
514 'diff' => $currentRevision,
515 'oldid' => $last->mAttribs['rc_last_oldid'],
517 array( 'known', 'noclasses' )
519 if ( $sinceLast > 0 && $sinceLast < $n ) {
520 $links['total-changes-since-last'] = Linker::link(
521 $block0->getTitle(),
522 $sinceLastVisitMsg[$sinceLast],
523 array(),
524 $queryParams + array(
525 'diff' => $currentRevision,
526 'oldid' => $unvisitedOldid,
528 array( 'known', 'noclasses' )
534 # History
535 if ( $allLogs || $rcObj->mAttribs['rc_type'] == RC_CATEGORIZE ) {
536 // don't show history link for logs
537 } elseif ( $namehidden || !$block0->getTitle()->exists() ) {
538 $links['history'] = $this->message['enhancedrc-history'];
539 } else {
540 $params = $queryParams;
541 $params['action'] = 'history';
543 $links['history'] = Linker::linkKnown(
544 $block0->getTitle(),
545 $this->message['enhancedrc-history'],
546 array(),
547 $params
551 # Allow others to alter, remove or add to these links
552 Hooks::run( 'EnhancedChangesList::getLogText',
553 array( $this, &$links, $block ) );
555 if ( !$links ) {
556 return '';
559 $logtext = implode( $this->message['pipe-separator'], $links );
560 $logtext = $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
561 return ' ' . $logtext;
565 * Enhanced RC ungrouped line.
567 * @param RecentChange|RCCacheEntry $rcObj
568 * @return string A HTML formatted line (generated using $r)
570 protected function recentChangesBlockLine( $rcObj ) {
571 $data = array();
573 $query['curid'] = $rcObj->mAttribs['rc_cur_id'];
575 $type = $rcObj->mAttribs['rc_type'];
576 $logType = $rcObj->mAttribs['rc_log_type'];
577 $classes = array( 'mw-enhanced-rc' );
578 if ( $logType ) {
579 # Log entry
580 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-' . $logType );
581 } else {
582 $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
583 $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
585 $classes[] = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
586 ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
588 # Flag and Timestamp
589 $data['recentChangesFlags'] = array(
590 'newpage' => $type == RC_NEW,
591 'minor' => $rcObj->mAttribs['rc_minor'],
592 'unpatrolled' => $rcObj->unpatrolled,
593 'bot' => $rcObj->mAttribs['rc_bot'],
595 // timestamp is not really a link here, but is called timestampLink
596 // for consistency with EnhancedChangesListModifyLineData
597 $data['timestampLink'] = $rcObj->timestamp;
599 # Article or log link
600 if ( $logType ) {
601 $logPage = new LogPage( $logType );
602 $logTitle = SpecialPage::getTitleFor( 'Log', $logType );
603 $logName = $logPage->getName()->escaped();
604 $data['logLink'] = $this->msg( 'parentheses' )
605 ->rawParams( Linker::linkKnown( $logTitle, $logName ) )->escaped();
606 } else {
607 $data['articleLink'] = $this->getArticleLink( $rcObj, $rcObj->unpatrolled, $rcObj->watched );
610 # Diff and hist links
611 if ( $type != RC_LOG && $type != RC_CATEGORIZE ) {
612 $query['action'] = 'history';
613 $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
615 $data['separatorAfterLinks'] = ' <span class="mw-changeslist-separator">. .</span> ';
617 # Character diff
618 if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
619 $cd = $this->formatCharacterDifference( $rcObj );
620 if ( $cd !== '' ) {
621 $data['characterDiff'] = $cd;
622 $data['separatorAftercharacterDiff'] = ' <span class="mw-changeslist-separator">. .</span> ';
626 if ( $type == RC_LOG ) {
627 $data['logEntry'] = $this->insertLogEntry( $rcObj );
628 } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
629 $data['comment'] = $this->insertComment( $rcObj );
630 } else {
631 $data['userLink'] = $rcObj->userlink;
632 $data['userTalkLink'] = $rcObj->usertalklink;
633 $data['comment'] = $this->insertComment( $rcObj );
634 if ( $type == RC_CATEGORIZE ) {
635 $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
637 $data['rollback'] = $this->getRollback( $rcObj );
640 # Tags
641 $data['tags'] = $this->getTags( $rcObj, $classes );
643 # Show how many people are watching this if enabled
644 $data['watchingUsers'] = $this->numberofWatchingusers( $rcObj->numberofWatchingusers );
646 // give the hook a chance to modify the data
647 $success = Hooks::run( 'EnhancedChangesListModifyBlockLineData',
648 array( $this, &$data, $rcObj ) );
649 if ( !$success ) {
650 // skip entry if hook aborted it
651 return '';
654 $line = Html::openElement( 'table', array( 'class' => $classes ) ) .
655 Html::openElement( 'tr' );
656 $line .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow-space"></span>';
658 if ( isset( $data['recentChangesFlags'] ) ) {
659 $line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
660 unset( $data['recentChangesFlags'] );
663 if ( isset( $data['timestampLink'] ) ) {
664 $line .= '&#160;' . $data['timestampLink'];
665 unset( $data['timestampLink'] );
667 $line .= '&#160;</td><td>';
669 // everything else: makes it easier for extensions to add or remove data
670 $line .= implode( '', $data );
672 $line .= "</td></tr></table>\n";
674 return $line;
678 * Returns value to be used in 'historyLink' element of $data param in
679 * EnhancedChangesListModifyBlockLineData hook.
681 * @since 1.27
683 * @param RCCacheEntry $rc
684 * @param array $query array of key/value pairs to append as a query string
685 * @return string HTML
687 public function getDiffHistLinks( RCCacheEntry $rc, array $query ) {
688 $pageTitle = $rc->getTitle();
689 if ( $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE ) {
690 // For categorizations we must swap the category title with the page title!
691 $pageTitle = Title::newFromID( $rc->getAttribute( 'rc_cur_id' ) );
694 $retVal = ' ' . $this->msg( 'parentheses' )
695 ->rawParams( $rc->difflink . $this->message['pipe-separator'] . Linker::linkKnown(
696 $pageTitle,
697 $this->message['hist'],
698 array(),
699 $query
700 ) )->escaped();
701 return $retVal;
705 * If enhanced RC is in use, this function takes the previously cached
706 * RC lines, arranges them, and outputs the HTML
708 * @return string
710 protected function recentChangesBlock() {
711 if ( count( $this->rc_cache ) == 0 ) {
712 return '';
715 $blockOut = '';
716 foreach ( $this->rc_cache as $block ) {
717 if ( count( $block ) < 2 ) {
718 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
719 } else {
720 $blockOut .= $this->recentChangesBlockGroup( $block );
724 return '<div>' . $blockOut . '</div>';
728 * Returns text for the end of RC
729 * If enhanced RC is in use, returns pretty much all the text
730 * @return string
732 public function endRecentChangesList() {
733 return $this->recentChangesBlock() . '</div>';