r108189 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108188‎ | r108189 | r108190 >
Date:01:33, 6 January 2012
Author:bsitu
Status:ok
Tags:
Comment:
Reduce db query call for user info by using User::newFromRow and pre-loading necessary user data in the aggregate query
Modified paths:
  • /trunk/extensions/MoodBar/SpecialFeedbackDashboard.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/SpecialFeedbackDashboard.php
@@ -309,7 +309,7 @@
310310 if ( isset( $response[$id] ) ) {
311311 $response_detail = $response[$id];
312312
313 - $responder = User::newFromId( $response_detail->mbfr_user_id );
 313+ $responder = User::newFromRow( $response_detail );
314314
315315 if ( $responder && !$responder->isAnon() ) {
316316 $responsetime = MoodBarUtil::formatTimeSince( wfTimestamp( TS_UNIX, $response_detail->mbfr_timestamp ) );
@@ -730,9 +730,9 @@
731731
732732 // get the detail for each mbfr_id
733733 if ( count( $mbfrId ) > 0 ) {
734 - $res = $dbr->select( array( 'moodbar_feedback_response' ),
735 - array( 'mbfr_id', 'mbfr_mbf_id', 'mbfr_user_id', 'mbfr_timestamp' ),
736 - array( 'mbfr_id' => $mbfrId ),
 734+ $res = $dbr->select( array( 'moodbar_feedback_response', 'user' ),
 735+ array( 'mbfr_id', 'mbfr_mbf_id', 'mbfr_timestamp', 'user_id', 'user_name', 'user_real_name' ),
 736+ array( 'mbfr_id' => $mbfrId, 'mbfr_user_id = user_id' ),
737737 __METHOD__
738738 );
739739

Status & tagging log