Index: trunk/extensions/SocialProfile/UserStats/UserStatsClass.php |
— | — | @@ -475,6 +475,8 @@ |
476 | 476 | /** |
477 | 477 | * Updates the amount of relationships (friends or foes) if the user isn't |
478 | 478 | * an anonymous one. |
| 479 | + * This is called by UserRelationship::removeRelationshipByUserID(), which |
| 480 | + * in turn is called when removing friends or foes. |
479 | 481 | * |
480 | 482 | * @param $relType Integer: 1 for updating friends |
481 | 483 | */ |
— | — | @@ -487,7 +489,7 @@ |
488 | 490 | } else { |
489 | 491 | $col = 'stats_foe_count'; |
490 | 492 | } |
491 | | - $relationships = $dbw->select( |
| 493 | + $relationships = $dbw->selectField( |
492 | 494 | 'user_relationship', |
493 | 495 | 'COUNT(*) AS rel_count', |
494 | 496 | array( 'r_user_id' => $this->user_id, 'r_type' => $relType ), |
— | — | @@ -495,7 +497,7 @@ |
496 | 498 | ); |
497 | 499 | $res = $dbw->update( |
498 | 500 | 'user_stats', |
499 | | - array( $col => $relationships->rel_count ), |
| 501 | + array( $col => $relationships ), |
500 | 502 | array( 'stats_user_id' => $this->user_id ), |
501 | 503 | __METHOD__, |
502 | 504 | array( 'LOW_PRIORITY' ) |