r50936 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50935‎ | r50936 | r50937 >
Date:11:14, 23 May 2009
Author:ashley
Status:deferred
Tags:
Comment:
SocialProfile: bugfixes + documentation + converted a couple raw SQL queries to use Database class in UserStatsClass.php
Modified paths:
  • /trunk/extensions/SocialProfile/UserStats/UserStatsClass.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserStats/UserStatsClass.php
@@ -67,12 +67,17 @@
6868 'links_approved' => 'stats_links_approved'
6969 );
7070
 71+ /**
 72+ * Constructor
 73+ * @param $user_id Integer: ID number of the user that we want to track stats for
 74+ * @param $user_name Mixed: user's name; if not supplied, then the user ID will be used to get the user name from DB.
 75+ */
7176 function UserStatsTrack( $user_id, $user_name = '' ){
7277 global $wgUserStatsPointValues;
7378
7479 $this->user_id = $user_id;
7580 if( !$user_name ){
76 - $user = User::newFromId($this->user_id);
 81+ $user = User::newFromId( $this->user_id );
7782 $user->loadFromDatabase();
7883 $user_name = $user->getName();
7984 }
@@ -82,6 +87,9 @@
8388 $this->initStatsTrack();
8489 }
8590
 91+ /**
 92+ * Checks if records for the given user are present in user_stats table and if not, adds them
 93+ */
8694 function initStatsTrack(){
8795 $dbr = wfGetDB( DB_SLAVE );
8896 $s = $dbr->selectRow( 'user_stats', array( 'stats_user_id' ), array( 'stats_user_id' => $this->user_id ), __METHOD__ );
@@ -91,19 +99,24 @@
92100 }
93101 }
94102
 103+ /**
 104+ * Adds a record for the given user into the user_stats table
 105+ */
95106 function addStatRecord(){
96107 $dbw = wfGetDB( DB_MASTER );
97108 $dbw->insert( 'user_stats',
98 -
99 - array(
100 - 'stats_year_id' => 0,
101 - 'stats_user_id' => $this->user_id,
102 - 'stats_user_name' => $this->user_name,
103 - 'stats_total_points' => 1000
 109+ array(
 110+ 'stats_year_id' => 0,
 111+ 'stats_user_id' => $this->user_id,
 112+ 'stats_user_name' => $this->user_name,
 113+ 'stats_total_points' => 1000
104114 ), __METHOD__
105115 );
106116 }
107117
 118+ /**
 119+ * Deletes Memcached entries
 120+ */
108121 function clearCache(){
109122 global $wgMemc;
110123
@@ -113,21 +126,22 @@
114127 }
115128
116129 function incStatField( $field, $val = 1 ){
117 - global $wgUser, $IP, $wgDBprefix, $wgMemc, $wgSitename, $wgSystemGifts, $wgUserStatsTrackWeekly, $wgUserStatsTrackMonthly, $wgUserStatsPointValues;
 130+ global $wgUser, $wgMemc, $wgSystemGifts, $wgUserStatsTrackWeekly, $wgUserStatsTrackMonthly, $wgUserStatsPointValues;
118131 if( !$wgUser->isAllowed( 'bot' ) && !$wgUser->isAnon() && $this->stats_fields[$field] ) {
119132 $dbw = wfGetDB( DB_MASTER );
120133 $dbw->update( 'user_stats',
121 - array( $this->stats_fields[$field]."=".$this->stats_fields[$field]."+{$val}" ),
 134+ array( $this->stats_fields[$field] . '=' . $this->stats_fields[$field] . "+{$val}" ),
122135 array( 'stats_user_id' => $this->user_id ),
123 - __METHOD__ );
 136+ __METHOD__
 137+ );
124138 $this->updateTotalPoints();
125139
126140 $this->clearCache();
127141
128142 // update weekly/monthly points
129 - if( $this->point_values[$field] ){
130 - if( $wgUserStatsTrackWeekly ) $this->updateWeeklyPoints($this->point_values[$field]);
131 - if( $wgUserStatsTrackMonthly ) $this->updateMonthlyPoints($this->point_values[$field]);
 143+ if( isset( $this->point_values[$field] ) && !empty( $this->point_values[$field] ) ){
 144+ if( $wgUserStatsTrackWeekly ) $this->updateWeeklyPoints( $this->point_values[$field] );
 145+ if( $wgUserStatsTrackMonthly ) $this->updateMonthlyPoints( $this->point_values[$field] );
132146 }
133147
134148 if( $wgSystemGifts ){
@@ -135,7 +149,7 @@
136150 $stat_field = $this->stats_fields[$field];
137151 $field_count = $s->$stat_field;
138152
139 - $key = wfMemcKey( 'system_gift', 'id', $field."-".$field_count );
 153+ $key = wfMemcKey( 'system_gift', 'id', $field . '-' . $field_count );
140154 $data = $wgMemc->get( $key );
141155
142156 if( $data ){
@@ -143,15 +157,15 @@
144158 $system_gift_id = $data;
145159 } else {
146160 $g = new SystemGifts();
147 - $system_gift_id = $g->doesGiftExistForThreshold($field, $field_count);
 161+ $system_gift_id = $g->doesGiftExistForThreshold( $field, $field_count );
148162 if( $system_gift_id ){
149163 $wgMemc->set( $key, $system_gift_id, 60 * 30 );
150164 }
151165 }
152166
153167 if( $system_gift_id ){
154 - $sg = new UserSystemGifts($this->user_name);
155 - $sg->sendSystemGift($system_gift_id);
 168+ $sg = new UserSystemGifts( $this->user_name );
 169+ $sg->sendSystemGift( $system_gift_id );
156170 }
157171 }
158172 }
@@ -162,14 +176,17 @@
163177 if( !$wgUser->isAllowed( 'bot' ) && !$wgUser->isAnon() && $this->stats_fields[$field] ) {
164178 $dbw = wfGetDB( DB_MASTER );
165179 $dbw->update( 'user_stats',
166 - array( $this->stats_fields[$field]."=".$this->stats_fields[$field]."-{$val}" ),
 180+ array( $this->stats_fields[$field] . '=' . $this->stats_fields[$field] . "-{$val}" ),
167181 array( 'stats_user_id' => $this->user_id ),
168 - __METHOD__ );
 182+ __METHOD__
 183+ );
169184
170185 if( $this->point_values[$field] ){
171186 $this->updateTotalPoints();
172 - if( $wgUserStatsTrackWeekly ) $this->updateWeeklyPoints(0-($this->point_values[$field]));
173 - if( $wgUserStatsTrackMonthly ) $this->updateMonthlyPoints(0-($this->point_values[$field]));
 187+ if( $wgUserStatsTrackWeekly )
 188+ $this->updateWeeklyPoints( 0 - ( $this->point_values[$field] ) );
 189+ if( $wgUserStatsTrackMonthly )
 190+ $this->updateMonthlyPoints( 0 - ( $this->point_values[$field] ) );
174191 }
175192
176193 $this->clearCache();
@@ -197,7 +214,7 @@
198215 $dbw = wfGetDB( DB_MASTER );
199216 $sql = "UPDATE ".$wgDBprefix."user_stats SET ";
200217 $sql .= 'stats_comment_blocked=';
201 - $sql .= "(SELECT COUNT(*) AS CommentCount FROM Comments_block WHERE cb_user_id_blocked = " . $this->user_id;
 218+ $sql .= "(SELECT COUNT(*) AS CommentCount FROM Comments_block WHERE cb_user_id_blocked = " . $this->user_id;
202219 $sql .= ")";
203220 $sql .= " WHERE stats_user_id = " . $this->user_id;
204221 $res = $dbw->query($sql);
@@ -206,6 +223,10 @@
207224 }
208225 }
209226
 227+ /**
 228+ * Update the amount of edits for a given user
 229+ * Edit count is fetched from revision table
 230+ */
210231 function updateEditCount(){
211232 global $wgUser, $wgDBprefix;
212233 if( !$wgUser->isAnon() ) {
@@ -258,9 +279,9 @@
259280 function updateCreatedOpinionsCount(){
260281 global $wgUser, $wgOut, $wgDBprefix;
261282 if( !$wgUser->isAnon() && $this->user_id ) {
262 - $ctg = "Opinions by User " . ($this->user_name);
 283+ $ctg = 'Opinions by User ' . ( $this->user_name );
263284 $parser = new Parser();
264 - $CtgTitle = Title::newFromText( $parser->transformMsg( trim($ctg), $wgOut->parserOptions() ) );
 285+ $CtgTitle = Title::newFromText( $parser->transformMsg( trim( $ctg ), $wgOut->parserOptions() ) );
265286 $CtgTitle = $CtgTitle->getDBKey();
266287 $dbw = wfGetDB( DB_MASTER );
267288 $sql = "UPDATE ".$wgDBprefix."user_stats SET stats_opinions_created=";
@@ -278,8 +299,8 @@
279300 global $wgUser, $wgOut, $wgDBprefix;
280301 $parser = new Parser();
281302 $dbw = wfGetDB( DB_MASTER );
282 - $ctg = "Opinions by User " . ($this->user_name);
283 - $CtgTitle = Title::newFromText( $parser->transformMsg( trim($ctg), $wgOut->parserOptions() ) );
 303+ $ctg = 'Opinions by User ' . ( $this->user_name );
 304+ $CtgTitle = Title::newFromText( $parser->transformMsg( trim( $ctg ), $wgOut->parserOptions() ) );
284305 $CtgTitle = $CtgTitle->getDBKey();
285306 $sql = "UPDATE ".$wgDBprefix."user_stats SET stats_opinions_published = ";
286307 $sql .= "(SELECT count(*) AS PromotedOpinions FROM {$dbw->tableName( 'page' )} INNER JOIN {$dbw->tableName( 'categorylinks' )} ON page_id = cl_from INNER JOIN published_page ON page_id=published_page_id WHERE (cl_to) = " . $dbw->addQuotes($CtgTitle) . " AND published_type=1 " . " " . $timeSQL;
@@ -309,7 +330,7 @@
310331 }
311332
312333 function updateGiftCountRec(){
313 - global $wgUser, $wgStatsStartTimestamp, $wgDBprefix;
 334+ global $wgUser, $wgDBprefix;
314335 if( !$wgUser->isAnon() ) {
315336 $dbw = wfGetDB( DB_MASTER );
316337 $sql = "UPDATE LOW_PRIORITY ".$wgDBprefix."user_stats SET stats_gifts_rec_count=
@@ -337,7 +358,7 @@
338359 }
339360
340361 public function updateReferralComplete(){
341 - global $wgUser, $wgStatsStartTimestamp, $wgDBprefix;
 362+ global $wgUser, $wgDBprefix;
342363 if( !$wgUser->isAnon() ) {
343364 $dbw = wfGetDB( DB_MASTER );
344365 $sql = "UPDATE LOW_PRIORITY ".$wgDBprefix."user_stats SET stats_referrals_completed=
@@ -351,78 +372,75 @@
352373 }
353374
354375 public function updateWeeklyPoints( $points ){
355 - global $wgDBprefix;
356376 $dbw = wfGetDB( DB_MASTER );
357 - $sql = "SELECT up_user_id FROM ".$wgDBprefix."user_points_weekly WHERE up_user_id = {$this->user_id}";
358 - $res = $dbw->query($sql);
 377+ $res = $dbw->select( 'user_points_weekly', 'up_user_id', array( "up_user_id = {$this->user_id}" ), __METHOD__ );
359378 $row = $dbw->fetchObject( $res );
360379
361380 if( !$row ){
362381 $this->addWeekly();
363382 }
364383 $dbw->update( 'user_points_weekly',
365 - array( 'up_points=up_points+'.$points ),
366 - array( 'up_user_id' => $this->user_id ),
367 - __METHOD__ );
 384+ array( 'up_points=up_points+' . $points ),
 385+ array( 'up_user_id' => $this->user_id ),
 386+ __METHOD__
 387+ );
368388 }
369389
370390 public function addWeekly(){
371391 $dbw = wfGetDB( DB_MASTER );
372392 $dbw->insert( 'user_points_weekly',
373 - array(
374 - 'up_user_id' => $this->user_id,
375 - 'up_user_name' => $this->user_name
 393+ array(
 394+ 'up_user_id' => $this->user_id,
 395+ 'up_user_name' => $this->user_name
376396 ), __METHOD__
377397 );
378398 }
379399
380400 public function updateMonthlyPoints( $points ){
381 - global $wgDBprefix;
382401 $dbw = wfGetDB( DB_MASTER );
383 - $sql = "SELECT up_user_id FROM ".$wgDBprefix."user_points_monthly WHERE up_user_id = {$this->user_id}";
384 - $res = $dbw->query($sql);
 402+ $res = $dbw->select( 'user_points_monthly', 'up_user_id', array( "up_user_id = {$this->user_id}" ), __METHOD__ );
385403 $row = $dbw->fetchObject( $res );
386404 if( !$row ){
387405 $this->addMonthly();
388406 }
389407
390408 $dbw->update( 'user_points_monthly',
391 - array( 'up_points=up_points+'.$points),
392 - array( 'up_user_id' => $this->user_id ),
393 - __METHOD__ );
 409+ array( 'up_points=up_points+' . $points ),
 410+ array( 'up_user_id' => $this->user_id ),
 411+ __METHOD__
 412+ );
394413 }
395414
396415 public function addMonthly(){
397416 $dbw = wfGetDB( DB_MASTER );
398417 $dbw->insert( 'user_points_monthly',
399 - array(
400 - 'up_user_id' => $this->user_id,
401 - 'up_user_name' => $this->user_name
 418+ array(
 419+ 'up_user_id' => $this->user_id,
 420+ 'up_user_name' => $this->user_name
402421 ), __METHOD__
403422 );
404423 }
405424
406425 public function updateTotalPoints(){
407 - global $wgEnableFacebook, $wgUserLevels, $wgDBprefix;
 426+ global $wgEnableFacebook, $wgUserLevels;
408427
409 - if( $this->user_id == 0 ) return '';
 428+ if( $this->user_id == 0 )
 429+ return '';
410430
411431 $stats_data = array();
412432 if( is_array( $wgUserLevels ) ){
413433 // Load points before update
414 - $stats = new UserStats($this->user_id, $this->user_name);
 434+ $stats = new UserStats( $this->user_id, $this->user_name );
415435 $stats_data = $stats->getUserStats();
416436 $points_before = $stats_data['points'];
417437
418438 // Load Honorific Level before update
419 - $user_level = new UserLevel($points_before);
 439+ $user_level = new UserLevel( $points_before );
420440 $level_number_before = $user_level->getLevelNumber();
421441 }
422442
423443 $dbw = wfGetDB( DB_MASTER );
424 - $sql = "SELECT *
425 - FROM ".$wgDBprefix."user_stats WHERE stats_user_id = " . $this->user_id;
426 - $res = $dbw->query($sql);
 444+ $res = $dbw->select( 'user_stats', '*', array( "stats_user_id = {$this->user_id}" ), __METHOD__ );
427445 $row = $dbw->fetchObject( $res );
428446 if( $row ){
429447 // recaculate point total
@@ -442,21 +460,22 @@
443461 }
444462
445463 $dbw->update( 'user_stats',
446 - array( 'stats_total_points' => $new_total_points),
447 - array( 'stats_user_id' => $this->user_id ),
448 - __METHOD__ );
 464+ array( 'stats_total_points' => $new_total_points ),
 465+ array( 'stats_user_id' => $this->user_id ),
 466+ __METHOD__
 467+ );
449468
450469 // If user levels is in settings, check to see if user advanced with update
451470 if( is_array( $wgUserLevels ) ){
452471 // Get New Honorific Level
453 - $user_level = new UserLevel($new_total_points);
 472+ $user_level = new UserLevel( $new_total_points );
454473 $level_number_after = $user_level->getLevelNumber();
455474
456475 // Check if user advanced on this update
457 - /*if($level_number_after > $level_number_before){
 476+ /*if( $level_number_after > $level_number_before ){
458477 $m = new UserSystemMessage();
459 - $m->addMessage($this->user_name, 2, "advanced to level <span style=\"font-weight:800;\">{$user_level->getLevelName()}</span>");
460 - $m->sendAdvancementNotificationEmail($this->user_id, $user_level->getLevelName());
 478+ $m->addMessage( $this->user_name, 2, "advanced to level <span style=\"font-weight:800;\">{$user_level->getLevelName()}</span>" );
 479+ $m->sendAdvancementNotificationEmail( $this->user_id, $user_level->getLevelName() );
461480 }*/
462481 }
463482 $this->clearCache();
@@ -469,11 +488,13 @@
470489 /**
471490 * Constructor
472491 * @private
 492+ * @param $user_id Integer: ID number of the user that we want to track stats for
 493+ * @param $user_name Mixed: user's name; if not supplied, then the user ID will be used to get the user name from DB.
473494 */
474495 /* private */ function __construct( $user_id, $user_name ) {
475496 $this->user_id = $user_id;
476497 if( !$user_name ){
477 - $user = User::newFromId($this->user_id);
 498+ $user = User::newFromId( $this->user_id );
478499 $user->loadFromDatabase();
479500 $user_name = $user->getName();
480501 }
@@ -499,6 +520,9 @@
500521 'gifts_sent_count' => 'Gifts Sent'
501522 );
502523
 524+ /**
 525+ * Retrieves per-user statistics, either from Memcached or from the database
 526+ */
503527 public function getUserStats(){
504528 $stats = $this->getUserStatsCache();
505529 if( !$stats ){
@@ -507,6 +531,9 @@
508532 return $stats;
509533 }
510534
 535+ /**
 536+ * Retrieves cached per-user statistics from Memcached, if possible
 537+ */
511538 public function getUserStatsCache(){
512539 global $wgMemc;
513540 $key = wfMemcKey( 'user', 'stats', $this->user_id );
@@ -517,14 +544,15 @@
518545 }
519546 }
520547
 548+ /**
 549+ * Retrieves per-user statistics from the database
 550+ */
521551 public function getUserStatsDB(){
522552 global $wgMemc, $wgDBprefix;
523553
524554 wfDebug( "Got user stats for {$this->user_name} from DB\n" );
525555 $dbr = wfGetDB( DB_MASTER );
526 - $sql = "SELECT *
527 - FROM ".$wgDBprefix."user_stats
528 - WHERE stats_user_id = {$this->user_id} LIMIT 0,1";
 556+ $sql = "SELECT * FROM ".$wgDBprefix."user_stats WHERE stats_user_id = {$this->user_id} LIMIT 0,1";
529557 $res = $dbr->query($sql);
530558 $row = $dbr->fetchObject( $res );
531559 $stats['edits'] = number_format( isset( $row->stats_edit_count ) ? $row->stats_edit_count : 0 );
@@ -542,17 +570,17 @@
543571 $stats['foe_count'] = number_format( isset( $row->stats_foe_count ) ? $row->stats_foe_count : 0 );
544572 $stats['user_board'] = number_format( isset( $row->user_board_count ) ? $row->user_board_count : 0 );
545573 $stats['user_board_priv'] = number_format( isset( $row->user_board_count_priv ) ? $row->user_board_count_priv : 0 );
546 - $stats['user_board_sent'] = number_format( isset( $row->user_board_sent ) ? $row->user_board_sent : 0);
547 - $stats['weekly_wins'] = number_format( isset( $row->stats_weekly_winner_count ) ? $row->stats_weekly_winner_count : 0);
548 - $stats['monthly_wins'] = number_format( isset( $row->stats_monthly_winner_count ) ? $row->stats_monthly_winner_count : 0);
 574+ $stats['user_board_sent'] = number_format( isset( $row->user_board_sent ) ? $row->user_board_sent : 0 );
 575+ $stats['weekly_wins'] = number_format( isset( $row->stats_weekly_winner_count ) ? $row->stats_weekly_winner_count : 0 );
 576+ $stats['monthly_wins'] = number_format( isset( $row->stats_monthly_winner_count ) ? $row->stats_monthly_winner_count : 0 );
549577 $stats['poll_votes'] = number_format( isset( $row->stats_poll_votes ) ? $row->stats_poll_votes : 0 );
550578 $stats['currency'] = number_format( isset( $row->stats_currency ) ? $row->stats_currency : 0 );
551579 $stats['picture_game_votes'] = number_format( isset( $row->stats_picturegame_votes ) ? $row->stats_picturegame_votes : 0 );
552580 $stats['quiz_created'] = number_format( isset( $row->stats_quiz_questions_created ) ? $row->stats_quiz_questions_created : 0 );
553581 $stats['quiz_answered'] = number_format( isset( $row->stats_quiz_questions_answered ) ? $row->stats_quiz_questions_answered : 0 );
554 - $stats['quiz_correct'] = number_format( isset( $row->stats_quiz_questions_correct ) ? $row->stats_quiz_questions_correct : 0);
 582+ $stats['quiz_correct'] = number_format( isset( $row->stats_quiz_questions_correct ) ? $row->stats_quiz_questions_correct : 0 );
555583 $stats['quiz_points'] = number_format( isset( $row->stats_quiz_points ) ? $row->stats_quiz_points : 0 );
556 - $stats['quiz_correct_percent'] = number_format( ( isset( $row->stats_quiz_questions_correct_percent ) ? $row->stats_quiz_questions_correct_percent : 0 ) *100, 2);
 584+ $stats['quiz_correct_percent'] = number_format( ( isset( $row->stats_quiz_questions_correct_percent ) ? $row->stats_quiz_questions_correct_percent : 0 ) * 100, 2 );
557585 $stats['user_status_count'] = number_format( isset( $row->user_status_count ) ? $row->user_status_count : 0 );
558586 if( !$row ){
559587 $stats['points'] = '1,000';
@@ -591,7 +619,7 @@
592620 return $list;
593621 }
594622
595 - static function getTopFansListPeriod( $limit = 10, $period = "weekly"){
 623+ static function getTopFansListPeriod( $limit = 10, $period = 'weekly' ){
596624 $dbr = wfGetDB( DB_SLAVE );
597625
598626 if( $limit > 0 ){
@@ -655,7 +683,7 @@
656684 );
657685 }
658686 if( $condition == 1 ){
659 - $list = array_reverse($list);
 687+ $list = array_reverse( $list );
660688 }
661689 return $list;
662690 }
@@ -668,7 +696,7 @@
669697 /* private */ function __construct( $points ) {
670698 global $wgUserLevels;
671699 $this->levels = $wgUserLevels;
672 - $this->points = (int)str_replace(",", "", $points);
 700+ $this->points = (int)str_replace( ',', '', $points );
673701 if( $this->levels ) $this->setLevel();
674702 }
675703
@@ -681,9 +709,9 @@
682710 } else {
683711 // Set next level and what they need to reach
684712 // Check if not already at highest level
685 - if( ($this->level_number) != count($this->levels) ){
 713+ if( ( $this->level_number ) != count( $this->levels ) ){
686714 $this->next_level_name = $level_name;
687 - $this->next_level_points_needed = ($level_points_needed - $this->points);
 715+ $this->next_level_points_needed = ( $level_points_needed - $this->points );
688716 return '';
689717 }
690718 }
@@ -693,45 +721,54 @@
694722 public function getLevelName(){ return $this->level_name; }
695723 public function getLevelNumber(){ return $this->level_number; }
696724 public function getNextLevelName(){ return $this->next_level_name; }
697 - public function getPointsNeededToAdvance(){ return number_format($this->next_level_points_needed); }
 725+ public function getPointsNeededToAdvance(){ return number_format( $this->next_level_points_needed ); }
698726 public function getLevelMinimum(){ return $this->levels[$this->level_name]; }
699727 }
700728
 729+/**
 730+ * Class for tracking email invitations
 731+ * Used by InviteContacts extension
 732+ */
701733 class UserEmailTrack {
702734
703735 /**
704736 * Constructor
705737 * @private
 738+ * @param $user_id Integer: ID number of the user that we want to track stats for
 739+ * @param $user_name Mixed: user's name; if not supplied, then the user ID will be used to get the user name from DB.
706740 */
707741 /* private */ function __construct( $user_id, $user_name ) {
708742 $this->user_id = $user_id;
709743 if( !$user_name ){
710 - $user = User::newFromId($this->user_id);
 744+ $user = User::newFromId( $this->user_id );
711745 $user->loadFromDatabase();
712746 $user_name = $user->getName();
713747 }
714748 $this->user_name = $user_name;
715749 }
716 - //type
717 - /*
 750+
 751+ /**
 752+ * @param $type Integer: one of the following:
718753 1 = Invite - Email Contacts sucker
719754 2 = Invite -CVS Contacts importer
720755 3 = Invite -Manually Address enter
721756 4 = Invite to Read - Manually Address enter
722757 5 = Invite to Edit - Manually Address enter
723758 6 = Invite to Rate - Manually Address enter
724 - */
 759+ * @param $count
 760+ * @param $page_title
 761+ */
725762 public function track_email( $type, $count, $page_title = '' ){
726763 if( $this->user_id > 0 ){
727764 $dbw = wfGetDB( DB_MASTER );
728765 $dbw->insert( 'user_email_track',
729 - array(
730 - 'ue_user_id' => $this->user_id,
731 - 'ue_user_name' => $this->user_name,
732 - 'ue_type' => $type,
733 - 'ue_count' => $count,
734 - 'ue_page_title' => $page_title,
735 - 'ue_date' => date("Y-m-d H:i:s"),
 766+ array(
 767+ 'ue_user_id' => $this->user_id,
 768+ 'ue_user_name' => $this->user_name,
 769+ 'ue_type' => $type,
 770+ 'ue_count' => $count,
 771+ 'ue_page_title' => $page_title,
 772+ 'ue_date' => date("Y-m-d H:i:s"),
736773 ), __METHOD__
737774 );
738775 }

Status & tagging log