r77339 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77338‎ | r77339 | r77340 >
Date:18:52, 26 November 2010
Author:ashley
Status:reverted
Tags:
Comment:
SocialProfile: replace UNIX_TIMESTAMP bits with $dbr->unixTimestamp() as per Mark's suggestion on code review for r75007
Modified paths:
  • /trunk/extensions/SocialProfile/SystemGifts/UserSystemGiftsClass.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserBoard/UserBoardClass.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserGifts/UserGiftsClass.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/SystemGifts/UserSystemGiftsClass.php
@@ -320,7 +320,8 @@
321321 array(
322322 'sg_id', 'sg_user_id', 'sg_user_name', 'sg_gift_id', 'sg_date',
323323 'sg_status', 'gift_name', 'gift_description',
324 - 'gift_given_count', 'UNIX_TIMESTAMP(sg_date) AS unix_time'
 324+ 'gift_given_count',
 325+ "{$dbr->unixTimestamp( 'sg_date' )} AS unix_time"
325326 ),
326327 array( "sg_user_id = {$this->user_id}" ),
327328 __METHOD__,
Index: trunk/extensions/SocialProfile/UserBoard/UserBoardClass.php
@@ -282,7 +282,7 @@
283283 }
284284
285285 $sql = "SELECT ub_id, ub_user_id_from, ub_user_name_from, ub_user_id, ub_user_name,
286 - ub_message,UNIX_TIMESTAMP(ub_date) AS unix_time,ub_type
 286+ ub_message,{$dbr->unixTimestamp( 'ub_date' )} AS unix_time,ub_type
287287 FROM {$dbr->tableName( 'user_board' )}
288288 WHERE {$user_sql}
289289 ORDER BY ub_id DESC
Index: trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php
@@ -75,7 +75,7 @@
7676 $user_sql = " WHERE rc_user = {$this->user_id}";
7777 }
7878
79 - $sql = "SELECT UNIX_TIMESTAMP(rc_timestamp) AS item_date, rc_title,
 79+ $sql = "SELECT {$dbr->unixTimestamp( 'rc_timestamp' )} AS item_date, rc_title,
8080 rc_user, rc_user_text, rc_comment, rc_id, rc_minor, rc_new,
8181 rc_namespace, rc_cur_id, rc_this_oldid, rc_last_oldid,
8282 rc_log_action
@@ -140,7 +140,7 @@
141141 $user_sql = " AND vote_user_id = {$this->user_id}";
142142 }
143143
144 - $sql = "SELECT UNIX_TIMESTAMP(vote_date) AS item_date, username,
 144+ $sql = "SELECT {$dbr->unixTimestamp( 'vote_date' )} AS item_date, username,
145145 page_title, vote_count, comment_count, vote_ip,
146146 vote_user_id
147147 FROM {$dbr->tableName( 'Vote' )} v, {$dbr->tableName( 'page' )} p
@@ -184,7 +184,7 @@
185185 $user_sql = "AND Comment_user_id = {$this->user_id}";
186186 }
187187
188 - $sql = "SELECT UNIX_TIMESTAMP(comment_date) AS item_date,
 188+ $sql = "SELECT {$dbr->unixTimestamp( 'comment_date' )} AS item_date,
189189 Comment_Username, Comment_IP, page_title, Comment_Text,
190190 Comment_user_id, page_namespace, CommentID
191191 FROM {$dbr->tableName( 'Comments' )} c, {$dbr->tableName( 'page' )} p
@@ -252,7 +252,7 @@
253253
254254 $sql = "SELECT ug_id, ug_user_id_from, ug_user_name_from,
255255 ug_user_id_to, ug_user_name_to,
256 - UNIX_TIMESTAMP(ug_date) AS item_date, gift_name, gift_id
 256+ {$dbr->unixTimestamp( 'ug_date' )} AS item_date, gift_name, gift_id
257257 FROM {$dbr->tableName( 'user_gift' )}
258258 INNER JOIN {$dbr->tableName( 'gift' )} ON gift_id = ug_gift_id
259259 {$rel_sql} {$user_sql}
@@ -289,7 +289,7 @@
290290
291291 $sql = "SELECT ug_id, ug_user_id_from, ug_user_name_from,
292292 ug_user_id_to, ug_user_name_to,
293 - UNIX_TIMESTAMP(ug_date) AS item_date, gift_name, gift_id
 293+ {$dbr->unixTimestamp( 'ug_date' )} AS item_date, gift_name, gift_id
294294 FROM {$dbr->tableName( 'user_gift' )}
295295 INNER JOIN {$dbr->tableName( 'gift' )} ON gift_id = ug_gift_id
296296 {$rel_sql} {$user_sql}
@@ -349,7 +349,7 @@
350350 }
351351
352352 $sql = "SELECT sg_id, sg_user_id, sg_user_name,
353 - UNIX_TIMESTAMP(sg_date) AS item_date, gift_name, gift_id
 353+ {$dbr->unixTimestamp( 'sg_date' )} AS item_date, gift_name, gift_id
354354 FROM {$dbr->tableName( 'user_system_gift' )}
355355 INNER JOIN {$dbr->tableName( 'system_gift' )} ON gift_id = sg_gift_id
356356 {$rel_sql} {$user_sql}
@@ -402,7 +402,9 @@
403403 } else {
404404 $user_sql = '';
405405 }
406 - $sql = "SELECT r_id, r_user_id, r_user_name, r_user_id_relation, r_user_name_relation, r_type, UNIX_TIMESTAMP(r_date) AS item_date
 406+ $sql = "SELECT r_id, r_user_id, r_user_name, r_user_id_relation,
 407+ r_user_name_relation, r_type,
 408+ {$dbr->unixTimestamp( 'r_date' )} AS item_date
407409 FROM {$dbr->tableName( 'user_relationship' )}
408410 {$rel_sql} {$user_sql}
409411 ORDER BY r_id DESC LIMIT 0,{$this->item_max}";
@@ -465,7 +467,8 @@
466468 }
467469
468470 $sql = "SELECT ub_id, ub_user_id, ub_user_name, ub_user_id_from,
469 - ub_user_name_from, UNIX_TIMESTAMP(ub_date) AS item_date,
 471+ ub_user_name_from,
 472+ {$dbr->unixTimestamp( 'ub_date' )} AS item_date,
470473 ub_message
471474 FROM {$dbr->tableName( 'user_board' )} WHERE
472475 {$rel_sql} {$user_sql} ub_type=0
@@ -523,7 +526,8 @@
524527 $user_sql = " WHERE um_user_id = {$this->user_id}";
525528 }
526529
527 - $sql = "SELECT um_id, um_user_id, um_user_name, um_type, um_message, UNIX_TIMESTAMP(um_date) AS item_date
 530+ $sql = "SELECT um_id, um_user_id, um_user_name, um_type, um_message,
 531+ {$dbr->unixTimestamp( 'um_date' )} AS item_date
528532 FROM {$dbr->tableName( 'user_system_messages' )}
529533 {$rel_sql} {$user_sql}
530534 ORDER BY um_id DESC LIMIT 0,{$this->item_max}";
Index: trunk/extensions/SocialProfile/UserGifts/UserGiftsClass.php
@@ -318,7 +318,8 @@
319319 array(
320320 'ug_id', 'ug_user_id_from', 'ug_user_name_from', 'ug_gift_id',
321321 'ug_date', 'ug_status', 'gift_name', 'gift_description',
322 - 'gift_given_count', 'UNIX_TIMESTAMP(ug_date) AS unix_time'
 322+ 'gift_given_count',
 323+ "{$dbr->unixTimestamp( 'ug_date' )} AS unix_time"
323324 ),
324325 array( "ug_user_id_to = {$this->user_id}" ),
325326 __METHOD__,
@@ -363,7 +364,8 @@
364365 array(
365366 'ug_id', 'ug_user_id_from', 'ug_user_name_from', 'ug_gift_id',
366367 'ug_date', 'ug_status', 'gift_name', 'gift_description',
367 - 'gift_given_count', 'UNIX_TIMESTAMP(ug_date) AS unix_time'
 368+ 'gift_given_count',
 369+ "{$dbr->unixTimestamp( 'ug_date' )} AS unix_time"
368370 ),
369371 array(),
370372 __METHOD__,

Follow-up revisions

RevisionCommit summaryAuthorDate
r79748SocialProfile: revert r77339 because Database::unixTimestamp was removed in r...ashley19:31, 6 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75007SocialProfile: improve docs on UserBoardClass.php and add one to-do (getNewMe...ashley09:09, 19 October 2010

Status & tagging log