From 935bca8ee764847868ce6c597b43eb74e0908c10 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 25 Nov 2004 12:34:48 +0000 Subject: [PATCH] * Avoid a lot of needless reparsing of titles coming out of the database * Stash message lookups used on every row (potentially used hundreds or thousands of times during the script run) * Fix undefined variable notice by removing mysterious unused line of code --- includes/SpecialContributions.php | 41 ++++++++++++++++++------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index fa5a1635cb..008853280a 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -208,46 +208,55 @@ function wfSpecialContributions( $par = '' ) { * @todo This would probably look a lot nicer in a table. */ function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor, $isnew, $target, $oldid ) { + $fname = 'ucListEdit'; + wfProfileIn( $fname ); + global $wgLang, $wgOut, $wgUser, $wgRequest; - $page = Title::makeName( $ns, $t ); - $link = $sk->makeKnownLink( $page, '' ); + static $messages; + if( !isset( $messages ) ) { + foreach( explode( ' ', 'uctop diff newarticle rollbacklink diff hist minoreditletter' ) as $msg ) { + $messages[$msg] = wfMsg( $msg ); + } + } + + $page =& Title::makeTitle( $ns, $t ); + $link = $sk->makeKnownLinkObj( $page, '' ); $difftext = $topmarktext = ''; if($topmark) { - $topmarktext .= '' . wfMsg('uctop') . ''; + $topmarktext .= '' . $messages['uctop'] . ''; if(!$isnew) { - $difftext .= $sk->makeKnownLink( $page, '(' . wfMsg('diff') . ')', 'diff=0' ); + $difftext .= $sk->makeKnownLinkObj( $page, '(' . $messages['diff'] . ')', 'diff=0' ); } else { - $difftext .= wfMsg('newarticle'); + $difftext .= $messages['newarticle']; } if( $wgUser->isAllowed('rollback') ) { $extraRollback = $wgRequest->getBool( 'bot' ) ? '&bot=1' : ''; # $target = $wgRequest->getText( 'target' ); - $topmarktext .= ' ['. $sk->makeKnownLink( $page, - wfMsg( 'rollbacklink' ), - 'action=rollback&from=' . urlencode( $target ) . $extraRollback ) .']'; + $topmarktext .= ' ['. $sk->makeKnownLinkObj( $page, + $messages['rollbacklink'], + 'action=rollback&from=' . urlencode( $target ) . $extraRollback ) .']'; } } if ( $oldid ) { - $difftext= $sk->makeKnownLink( $page, '('.wfMsg('diff').')', 'diff=prev&oldid='.$oldid ); + $difftext= $sk->makeKnownLinkObj( $page, '(' . $messages['diff'].')', 'diff=prev&oldid='.$oldid ); } - $histlink='('.$sk->makeKnownLink($page,wfMsg('hist'),'action=history').')'; - - if($comment) { - - $comment='('. $sk->formatComment($comment, Title::newFromText($t) ) .') '; + $histlink='('.$sk->makeKnownLinkObj( $page, $messages['hist'], 'action=history' ) . ')'; + if( $comment ) { + $comment = '(' . $sk->formatComment( $comment, $page ) . ') '; } $d = $wgLang->timeanddate( $ts, true ); if ($isminor) { - $mflag = ''.wfMsg( 'minoreditletter' ).' '; + $mflag = '' . $messages['minoreditletter'] . ' '; } else { $mflag = ''; } $wgOut->addHTML( "
  • {$d} {$histlink} {$difftext} {$mflag} {$link} {$comment} {$topmarktext}
  • \n" ); + wfProfileOut( $fname ); } /** @@ -302,8 +311,6 @@ function namespaceForm ( $target, $hideminor, $namespace ) { } $namespaceselect .= ''; - $frombox = ''; $submitbutton = ''; $out = "
    "; -- 2.20.1