UltrasonicNXT has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/97302


Change subject: Fix SQL errors being caused by $points being empty
......................................................................

Fix SQL errors being caused by $points being empty

I could not find why $points was empty, but a simple type check solves the
problem.

Change-Id: I174988e6e75978311150af41f3d98abb9b93454c
---
M UserStats/UserStatsClass.php
1 file changed, 16 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialProfile 
refs/changes/02/97302/1

diff --git a/UserStats/UserStatsClass.php b/UserStats/UserStatsClass.php
index 191148a..5f2ee79 100644
--- a/UserStats/UserStatsClass.php
+++ b/UserStats/UserStatsClass.php
@@ -521,12 +521,14 @@
                if ( !$row ) {
                        $this->addWeekly();
                }
-               $dbw->update(
-                       'user_points_weekly',
-                       array( 'up_points=up_points+' . $points ),
-                       array( 'up_user_id' => $this->user_id ),
-                       __METHOD__
-               );
+               if ( is_int( $points ) ) {
+                       $dbw->update(
+                               'user_points_weekly',
+                               array( 'up_points=up_points+' . $points ),
+                               array( 'up_user_id' => $this->user_id ),
+                               __METHOD__
+                       );
+               }
        }
 
        /**
@@ -557,13 +559,14 @@
                if ( !$row ) {
                        $this->addMonthly();
                }
-
-               $dbw->update(
-                       'user_points_monthly',
-                       array( 'up_points=up_points+' . $points ),
-                       array( 'up_user_id' => $this->user_id ),
-                       __METHOD__
-               );
+               if ( is_int( $points ) ) {
+                       $dbw->update(
+                               'user_points_monthly',
+                               array( 'up_points=up_points+' . $points ),
+                               array( 'up_user_id' => $this->user_id ),
+                               __METHOD__
+                       );
+               }
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/97302
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I174988e6e75978311150af41f3d98abb9b93454c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: UltrasonicNXT <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to