r55693 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55692‎ | r55693 | r55694 >
Date:11:54, 31 August 2009
Author:happy-melon
Status:ok
Tags:
Comment:
(bug 18880) Make LogEventsList::showLogExtract() more versatile by allowing it to take a string-by-reference instead of OutputPage; hence allowing it to be used for buffered content.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -557,29 +557,32 @@
558558
559559 /**
560560 * Quick function to show a short log extract
561 - * @param $out OutputPage
 561+ * @param $out OutputPage or String-by-reference
562562 * @param $types String or Array
563563 * @param $page String
564564 * @param $user String
565565 * @param $lim Integer
566566 * @param $conds Array
567567 */
568 - public static function showLogExtract( $out, $types=array(), $page='', $user='', $lim=0, $conds=array() ) {
569 - global $wgUser;
 568+ public static function showLogExtract( &$out, $types=array(), $page='', $user='', $lim=0, $conds=array() ) {
 569+ global $wgUser, $wgOut;
570570 # Insert list of top 50 or so items
571 - $loglist = new LogEventsList( $wgUser->getSkin(), $out, 0 );
 571+ $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
572572 $pager = new LogPager( $loglist, $types, $user, $page, '', $conds );
573573 if( $lim > 0 ) $pager->mLimit = $lim;
574574 $logBody = $pager->getBody();
575575 if( $logBody ) {
576 - $out->addHTML(
577 - $loglist->beginLogEventsList() .
578 - $logBody .
579 - $loglist->endLogEventsList()
580 - );
 576+ $s = $loglist->beginLogEventsList() .
 577+ $logBody .
 578+ $loglist->endLogEventsList();
581579 } else {
582 - $out->addWikiMsg( 'logempty' );
 580+ $s = wfMsgExt( 'logempty', array('parse') );
583581 }
 582+ if( $out instanceof OutputPage ){
 583+ $out->addHTML( $s );
 584+ } else {
 585+ $out = $s;
 586+ }
584587 return $pager->getNumRows();
585588 }
586589
Index: trunk/phase3/RELEASE-NOTES
@@ -199,6 +199,8 @@
200200 * MakeSysop and MakeBot are now aliases for Special:UserRights
201201 * IndexPager->mLimitsShown can now be an associative array of limit => text-to-
202202 display-in-limit-form.
 203+* (bug 18880) LogEventsList::showLogExtract() can now take a string-by-reference
 204+ and add its HTML to it, rather than having to go straight to $wgOut.
203205
204206 === Bug fixes in 1.16 ===
205207

Status & tagging log