From 19e33229155ce1dc44ee0b4ea515e56454e24466 Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Mon, 31 Aug 2009 11:54:53 +0000 Subject: [PATCH] (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. --- RELEASE-NOTES | 2 ++ includes/LogEventsList.php | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index aa149b0273..d256afd746 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -199,6 +199,8 @@ this. Was used when mwEmbed was going to be an extension. * MakeSysop and MakeBot are now aliases for Special:UserRights * IndexPager->mLimitsShown can now be an associative array of limit => text-to- display-in-limit-form. +* (bug 18880) LogEventsList::showLogExtract() can now take a string-by-reference + and add its HTML to it, rather than having to go straight to $wgOut. === Bug fixes in 1.16 === diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index d39842f472..d6178abc5a 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -557,28 +557,31 @@ class LogEventsList { /** * Quick function to show a short log extract - * @param $out OutputPage + * @param $out OutputPage or String-by-reference * @param $types String or Array * @param $page String * @param $user String * @param $lim Integer * @param $conds Array */ - public static function showLogExtract( $out, $types=array(), $page='', $user='', $lim=0, $conds=array() ) { - global $wgUser; + public static function showLogExtract( &$out, $types=array(), $page='', $user='', $lim=0, $conds=array() ) { + global $wgUser, $wgOut; # Insert list of top 50 or so items - $loglist = new LogEventsList( $wgUser->getSkin(), $out, 0 ); + $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 ); $pager = new LogPager( $loglist, $types, $user, $page, '', $conds ); if( $lim > 0 ) $pager->mLimit = $lim; $logBody = $pager->getBody(); if( $logBody ) { - $out->addHTML( - $loglist->beginLogEventsList() . - $logBody . - $loglist->endLogEventsList() - ); + $s = $loglist->beginLogEventsList() . + $logBody . + $loglist->endLogEventsList(); } else { - $out->addWikiMsg( 'logempty' ); + $s = wfMsgExt( 'logempty', array('parse') ); + } + if( $out instanceof OutputPage ){ + $out->addHTML( $s ); + } else { + $out = $s; } return $pager->getNumRows(); } -- 2.20.1