r59895 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59894‎ | r59895 | r59896 >
Date:18:48, 9 December 2009
Author:nimishg
Status:ok
Tags:
Comment:
switched "update" to use Database function
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UserDailyContribs/UserDailyContribs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UserDailyContribs/UserDailyContribs.hooks.php
@@ -39,9 +39,9 @@
4040 $today = gmdate( 'Ymd', time() );
4141 $dbw = wfGetDB( DB_MASTER );
4242
43 - //normal $db->update doesn't support SQL variables yet
44 - $sql = "UPDATE user_daily_contribs SET contribs=contribs+1 WHERE day = $today AND user_id = {$wgUser->getId()}";
45 - $dbw->query($sql, __METHOD__);
 43+ $dbw->update( 'user_daily_contribs', array( 'contribs=contribs+1' ),
 44+ array( 'day' => $today, 'user_id' => $wgUser->getId() ),
 45+ __METHOD__ );
4646
4747 if($dbw->affectedRows() == 0){
4848 $dbw->insert("user_daily_contribs", array("user_id" => $wgUser->getId(), "day" => $today, "contribs" => 1), __METHOD__);

Status & tagging log