r92619 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92618‎ | r92619 | r92620 >
Date:10:38, 20 July 2011
Author:ashley
Status:ok
Tags:
Comment:
SocialProfile: shut up "Notice: Undefined property: ResultWrapper::$rel_count in extensions\SocialProfile\UserStats\UserStatsClass.php on line 498" after removing a friend or a foe by using Database::selectField() here and document the (only) caller
Modified paths:
  • /trunk/extensions/SocialProfile/UserStats/UserStatsClass.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserStats/UserStatsClass.php
@@ -475,6 +475,8 @@
476476 /**
477477 * Updates the amount of relationships (friends or foes) if the user isn't
478478 * an anonymous one.
 479+ * This is called by UserRelationship::removeRelationshipByUserID(), which
 480+ * in turn is called when removing friends or foes.
479481 *
480482 * @param $relType Integer: 1 for updating friends
481483 */
@@ -487,7 +489,7 @@
488490 } else {
489491 $col = 'stats_foe_count';
490492 }
491 - $relationships = $dbw->select(
 493+ $relationships = $dbw->selectField(
492494 'user_relationship',
493495 'COUNT(*) AS rel_count',
494496 array( 'r_user_id' => $this->user_id, 'r_type' => $relType ),
@@ -495,7 +497,7 @@
496498 );
497499 $res = $dbw->update(
498500 'user_stats',
499 - array( $col => $relationships->rel_count ),
 501+ array( $col => $relationships ),
500502 array( 'stats_user_id' => $this->user_id ),
501503 __METHOD__,
502504 array( 'LOW_PRIORITY' )

Status & tagging log