http://www.mediawiki.org/wiki/Special:Code/MediaWiki/92619

Revision: 92619
Author:   ashley
Date:     2011-07-20 10:38:16 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
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: trunk/extensions/SocialProfile/UserStats/UserStatsClass.php
===================================================================
--- trunk/extensions/SocialProfile/UserStats/UserStatsClass.php 2011-07-20 
10:22:01 UTC (rev 92618)
+++ trunk/extensions/SocialProfile/UserStats/UserStatsClass.php 2011-07-20 
10:38:16 UTC (rev 92619)
@@ -475,6 +475,8 @@
        /**
         * Updates the amount of relationships (friends or foes) if the user 
isn't
         * an anonymous one.
+        * This is called by UserRelationship::removeRelationshipByUserID(), 
which
+        * in turn is called when removing friends or foes.
         *
         * @param $relType Integer: 1 for updating friends
         */
@@ -487,7 +489,7 @@
                        } else {
                                $col = 'stats_foe_count';
                        }
-                       $relationships = $dbw->select(
+                       $relationships = $dbw->selectField(
                                'user_relationship',
                                'COUNT(*) AS rel_count',
                                array( 'r_user_id' => $this->user_id, 'r_type' 
=> $relType ),
@@ -495,7 +497,7 @@
                        );
                        $res = $dbw->update(
                                'user_stats',
-                               array( $col => $relationships->rel_count ),
+                               array( $col => $relationships ),
                                array( 'stats_user_id' => $this->user_id ),
                                __METHOD__,
                                array( 'LOW_PRIORITY' )


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to