From 3f4ecb433f05c8a1bb0dc133ce9652efc8d4aa5c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 24 Nov 2004 12:02:22 +0000 Subject: [PATCH] Recentchanges optimization: avoid a lot of senseless parsing of link text coming out of the database, stash message lookups done in every line, and don't do two date formats when we only care about one. --- includes/Skin.php | 125 +++++++++++++++++++++++++++------------------- 1 file changed, 75 insertions(+), 50 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index fe02f15c5e..53094d7e07 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1409,21 +1409,18 @@ class Skin { wfProfileIn( $fname ); if ( !is_object( $nt ) ) { + wfProfileIn( $fname ); return $text; } - $link = $nt->getPrefixedURL(); -# if ( '' != $section && substr($section,0,1) != "#" ) { -# $section = '' - - if ( '' == $link ) { - $u = ''; - if ( '' == $text ) { - $text = htmlspecialchars( $nt->getFragment() ); - } - } else { - $u = $nt->escapeLocalURL( $query ); - } + + $u = $nt->escapeLocalURL( $query ); if ( '' != $nt->getFragment() ) { + if( $nt->getPrefixedDbkey() == '' ) { + $u = ''; + if ( '' == $text ) { + $text = htmlspecialchars( $nt->getFragment() ); + } + } $anchor = urlencode( do_html_entity_decode( str_replace(' ', '_', $nt->getFragment()), ENT_COMPAT, $wgInputEncoding ) ); $replacearray = array( '%3A' => ':', @@ -2192,8 +2189,18 @@ class Skin { } function recentChangesLineOld( &$rc, $watched = false ) { + $fname = 'Skin::recentChangesLineOld'; + wfProfileIn( $fname ); + global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol; + static $message; + if( !isset( $message ) ) { + foreach( explode(' ', 'diff hist minoreditletter newpageletter blocklink' ) as $msg ) { + $message[$msg] = wfMsg( $msg ); + } + } + # Extract DB fields into local scope extract( $rc->mAttribs ); $curIdEq = 'curid=' . $rc_cur_id; @@ -2203,12 +2210,11 @@ class Skin { ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') ) && $rc_patrolled == 0; # Make date header if necessary - $date = $wgContLang->date( $rc_timestamp, true); - $uidate = $wgLang->date( $rc_timestamp, true); + $date = $wgLang->date( $rc_timestamp, true); $s = ''; if ( $date != $this->lastdate ) { if ( '' != $this->lastdate ) { $s .= "\n"; } - $s .= "

{$uidate}

\n