r32961 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32960‎ | r32961 | r32962 >
Date:15:50, 8 April 2008
Author:aaron
Status:old
Tags:
Comment:
* Let MySQL choose among more indexes for title/user conditions
* Remove redlink contribs crap
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -158,19 +158,15 @@
159159 */
160160 public function logLine( $row ) {
161161 global $wgLang, $wgUser, $wgContLang;
162 - $skin = $wgUser->getSkin();
 162+
163163 $title = Title::makeTitle( $row->log_namespace, $row->log_title );
164164 $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->log_timestamp), true );
165 - // Enter the existence or non-existence of this page into the link cache,
166 - // for faster makeLinkObj() in LogPage::actionText()
167 - $linkCache =& LinkCache::singleton();
168 - $linkCache->addLinkObj( $title );
169165 // User links
170166 if( self::isDeleted($row,LogPage::DELETED_USER) ) {
171167 $userLink = '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
172168 } else {
173 - $userLink = $this->skin->userLink( $row->log_user, $row->user_name ) .
174 - $this->skin->userToolLinksRedContribs( $row->log_user, $row->user_name );
 169+ $userLink = $this->skin->userLink( $row->log_user, $row->user_name );
 170+ $this->skin->userToolLinks( $row->log_user, $row->user_name );
175171 }
176172 // Comment
177173 if( self::isDeleted($row,LogPage::DELETED_COMMENT) ) {
@@ -496,10 +492,8 @@
497493 global $wgAllowLogDeletion;
498494 $log_id = $wgAllowLogDeletion ? 'log_id' : '0 AS log_id';
499495 # Don't use the wrong logging index
500 - if( $this->title || $this->pattern ) {
501 - $index = array( 'USE INDEX' => array( 'logging' => 'page_time' ) );
502 - } else if( $this->user ) {
503 - $index = array( 'USE INDEX' => array( 'logging' => 'user_time' ) );
 496+ if( $this->title || $this->pattern || $this->user ) {
 497+ $index = array( 'USE INDEX' => array( 'logging' => array('page_time','user_time') ) );
504498 } else if( $this->type ) {
505499 $index = array( 'USE INDEX' => array( 'logging' => 'type_time' ) );
506500 } else {
@@ -517,6 +511,21 @@
518512 function getIndexField() {
519513 return 'log_timestamp';
520514 }
 515+
 516+ function getStartBody() {
 517+ wfProfileIn( __METHOD__ );
 518+ # Do a link batch query
 519+ $lb = new LinkBatch;
 520+ while( $row = $this->mResult->fetchObject() ) {
 521+ $lb->add( $row->log_namespace, $row->log_title );
 522+ $lb->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
 523+ $lb->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
 524+ }
 525+ $lb->execute();
 526+ $this->mResult->seek( 0 );
 527+ wfProfileOut( __METHOD__ );
 528+ return '';
 529+ }
521530
522531 function formatRow( $row ) {
523532 return $this->mLogEventsList->logLine( $row );

Status & tagging log