From: Rob Church Date: Wed, 22 Mar 2006 17:15:40 +0000 (+0000) Subject: Performance hacks to avoid killing the slaves; X-Git-Tag: 1.6.0~167 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=ef47deeec4e7687cb0a3856f4d9441789d030ea4;p=lhc%2Fweb%2Fwiklou.git Performance hacks to avoid killing the slaves; * Use a LinkBatch on the user and talk pages * Use makeKnownLinkObj on the contributions pages Thanks once again to Avar who saved me from stabbings. I leave tribute to him in the form of omission of a set of curly braces. --- diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index 59aafdb88f..2d61a47afe 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -57,6 +57,19 @@ class NewPagesPage extends QueryPage { WHERE rc_cur_id=page_id AND rc_new=1 AND rc_namespace=" . $this->namespace . " AND page_is_redirect=0"; } + + function preprocessResults( &$dbo, &$res ) { + # Do a batch existence check on the user and talk pages + $linkBatch = new LinkBatch(); + while( $row = $dbo->fetchObject( $res ) ) { + $linkBatch->addObj( Title::makeTitleSafe( NS_USER, $res->user_text ) ); + $linkBatch->addObj( Title::makeTitleSafe( NS_USER_TALK, $res_user_text ) ); + } + $linkBatch->execute(); + # Seek to start + if( $dbo->numRows( $res ) > 0 ) + $dbo->dataSeek( $res, 0 ); + } function formatResult( $skin, $result ) { global $wgLang, $wgContLang, $wgUser, $wgUseRCPatrol; @@ -67,7 +80,7 @@ class NewPagesPage extends QueryPage { $userLink = $skin->makeLinkObj( Title::makeTitle( NS_USER, $ut ), htmlspecialchars( $ut ) ); $talkLink = $skin->makeLinkObj( Title::makeTitle( NS_USER_TALK, $ut ), htmlspecialchars( $wgLang->getNsText( NS_TALK ) ) ); - $contLink = $skin->makeLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions/$ut" ), wfMsgHtml( 'contribslink' ) ); + $contLink = $skin->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions/$ut" ), wfMsgHtml( 'contribslink' ) ); $userTools = "$userLink ($talkLink | $contLink)"; $d = $wgLang->timeanddate( $result->timestamp, true );