From e1fa7b6bbe4d9dd691b04b3a4723bd189fde78a1 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 8 Apr 2008 15:50:16 +0000 Subject: [PATCH] * Let MySQL choose among more indexes for title/user conditions * Remove redlink contribs crap --- includes/LogEventsList.php | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 19790c45c3..b9a70a74ed 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -158,19 +158,15 @@ class LogEventsList { */ public function logLine( $row ) { global $wgLang, $wgUser, $wgContLang; - $skin = $wgUser->getSkin(); + $title = Title::makeTitle( $row->log_namespace, $row->log_title ); $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->log_timestamp), true ); - // Enter the existence or non-existence of this page into the link cache, - // for faster makeLinkObj() in LogPage::actionText() - $linkCache =& LinkCache::singleton(); - $linkCache->addLinkObj( $title ); // User links if( self::isDeleted($row,LogPage::DELETED_USER) ) { $userLink = '' . wfMsgHtml( 'rev-deleted-user' ) . ''; } else { - $userLink = $this->skin->userLink( $row->log_user, $row->user_name ) . - $this->skin->userToolLinksRedContribs( $row->log_user, $row->user_name ); + $userLink = $this->skin->userLink( $row->log_user, $row->user_name ); + $this->skin->userToolLinks( $row->log_user, $row->user_name ); } // Comment if( self::isDeleted($row,LogPage::DELETED_COMMENT) ) { @@ -496,10 +492,8 @@ class LogPager extends ReverseChronologicalPager { global $wgAllowLogDeletion; $log_id = $wgAllowLogDeletion ? 'log_id' : '0 AS log_id'; # Don't use the wrong logging index - if( $this->title || $this->pattern ) { - $index = array( 'USE INDEX' => array( 'logging' => 'page_time' ) ); - } else if( $this->user ) { - $index = array( 'USE INDEX' => array( 'logging' => 'user_time' ) ); + if( $this->title || $this->pattern || $this->user ) { + $index = array( 'USE INDEX' => array( 'logging' => array('page_time','user_time') ) ); } else if( $this->type ) { $index = array( 'USE INDEX' => array( 'logging' => 'type_time' ) ); } else { @@ -517,6 +511,21 @@ class LogPager extends ReverseChronologicalPager { function getIndexField() { return 'log_timestamp'; } + + function getStartBody() { + wfProfileIn( __METHOD__ ); + # Do a link batch query + $lb = new LinkBatch; + while( $row = $this->mResult->fetchObject() ) { + $lb->add( $row->log_namespace, $row->log_title ); + $lb->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); + $lb->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) ); + } + $lb->execute(); + $this->mResult->seek( 0 ); + wfProfileOut( __METHOD__ ); + return ''; + } function formatRow( $row ) { return $this->mLogEventsList->logLine( $row ); -- 2.20.1