Index: trunk/phase3/includes/Linker.php |
— | — | @@ -843,9 +843,10 @@ |
844 | 844 | * @param string $userText User name or IP address |
845 | 845 | * @param bool $redContribsWhenNoEdits Should the contributions link be red if the user has no edits? |
846 | 846 | * @param int $flags Customisation flags (e.g. self::TOOL_LINKS_NOBLOCK) |
| 847 | + * @param int $edits, user edit count (optional, for performance) |
847 | 848 | * @return string |
848 | 849 | */ |
849 | | - public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0 ) { |
| 850 | + public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits=null ) { |
850 | 851 | global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans; |
851 | 852 | $talkable = !( $wgDisableAnonTalk && 0 == $userId ); |
852 | 853 | $blockable = ( $wgSysopUserBans || 0 == $userId ) && !$flags & self::TOOL_LINKS_NOBLOCK; |
— | — | @@ -856,7 +857,8 @@ |
857 | 858 | } |
858 | 859 | if( $userId ) { |
859 | 860 | // check if the user has an edit |
860 | | - if( $redContribsWhenNoEdits && User::edits( $userId ) == 0 ) { |
| 861 | + $count = !is_null($edits) ? $edits : User::edits( $userId ); |
| 862 | + if( $redContribsWhenNoEdits && $count == 0 ) { |
861 | 863 | $style = " class='new'"; |
862 | 864 | } else { |
863 | 865 | $style = ''; |
Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -160,7 +160,7 @@ |
161 | 161 | $userLink = '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>'; |
162 | 162 | } else { |
163 | 163 | $userLink = $this->skin->userLink( $row->log_user, $row->user_name ) . |
164 | | - $this->skin->userToolLinks( $row->log_user, $row->user_name ); |
| 164 | + $this->skin->userToolLinks( $row->log_user, $row->user_name, true, 0, $row->user_editcount ); |
165 | 165 | } |
166 | 166 | // Comment |
167 | 167 | if( self::isDeleted($row,LogPage::DELETED_COMMENT) ) { |
— | — | @@ -432,7 +432,7 @@ |
433 | 433 | return false; |
434 | 434 | } |
435 | 435 | /* Fetch userid at first, if known, provides awesome query plan afterwards */ |
436 | | - $userid = User::idFromName( $this->user ); |
| 436 | + $userid = User::idFromName( $name ); |
437 | 437 | if( !$userid ) { |
438 | 438 | /* It should be nicer to abort query at all, |
439 | 439 | but for now it won't pass anywhere behind the optimizer */ |
— | — | @@ -485,8 +485,8 @@ |
486 | 486 | } |
487 | 487 | return array( |
488 | 488 | 'tables' => array( 'logging', 'user' ), |
489 | | - 'fields' => array( 'log_type', 'log_action', 'log_user', 'log_namespace', 'log_title', |
490 | | - 'log_params', 'log_comment', $log_id, 'log_deleted', 'log_timestamp', 'user_name' ), |
| 489 | + 'fields' => array( 'log_type', 'log_action', 'log_user', 'log_namespace', 'log_title', 'log_params', |
| 490 | + 'log_comment', $log_id, 'log_deleted', 'log_timestamp', 'user_name', 'user_editcount' ), |
491 | 491 | 'conds' => $this->mConds, |
492 | 492 | 'options' => $index |
493 | 493 | ); |
— | — | @@ -499,14 +499,16 @@ |
500 | 500 | function getStartBody() { |
501 | 501 | wfProfileIn( __METHOD__ ); |
502 | 502 | # Do a link batch query |
503 | | - $lb = new LinkBatch; |
504 | | - while( $row = $this->mResult->fetchObject() ) { |
505 | | - $lb->add( $row->log_namespace, $row->log_title ); |
506 | | - $lb->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); |
507 | | - $lb->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) ); |
| 503 | + if( $this->getNumRows() > 0 ) { |
| 504 | + $lb = new LinkBatch; |
| 505 | + while( $row = $this->mResult->fetchObject() ) { |
| 506 | + $lb->add( $row->log_namespace, $row->log_title ); |
| 507 | + $lb->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); |
| 508 | + $lb->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) ); |
| 509 | + } |
| 510 | + $lb->execute(); |
| 511 | + $this->mResult->seek( 0 ); |
508 | 512 | } |
509 | | - $lb->execute(); |
510 | | - $this->mResult->seek( 0 ); |
511 | 513 | wfProfileOut( __METHOD__ ); |
512 | 514 | return ''; |
513 | 515 | } |