r107078 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107077‎ | r107078 | r107079 >
Date:17:45, 22 December 2011
Author:bsitu
Status:ok
Tags:
Comment:
follow up to -r106985 - Use assignment style for NULL value in where clause
Modified paths:
  • /trunk/extensions/MarkAsHelpful/api/ApiMarkAsHelpful.php (modified) (history)
  • /trunk/extensions/MarkAsHelpful/includes/MarkAsHelpfulItem.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MarkAsHelpful/includes/MarkAsHelpfulItem.php
@@ -136,17 +136,8 @@
137137 */
138138 public function loadFromDatabase( $conds ) {
139139
140 - $searchKey = array();
 140+ $searchKey = array_keys ( $conds );
141141
142 - foreach ( $conds AS $key => $value) {
143 - if ( $value == 'mah_user_ip IS NULL' ) {
144 - $searchKey[] = 'mah_user_ip';
145 - }
146 - else {
147 - $searchKey[] = $key;
148 - }
149 - }
150 -
151142 $flag = sort( $searchKey );
152143
153144 if ( !$flag ) {
@@ -267,10 +258,10 @@
268259 $conds['mah_user_id'] = 0;
269260 } else {
270261 $conds['mah_user_id'] = $user->getId();
271 - $conds[] = 'mah_user_ip IS NULL';
 262+ $conds['mah_user_ip'] = NULL;
272263 }
273264 } else {
274 - // Invalid User object, we can't treat this user has marked an item
 265+ // Invalid User object, we can't allow this user to mark an item
275266 return true;
276267 }
277268
Index: trunk/extensions/MarkAsHelpful/api/ApiMarkAsHelpful.php
@@ -40,7 +40,7 @@
4141 $conds['mah_user_ip'] = $wgUser->getName();
4242 } else {
4343 $conds['mah_user_id'] = $wgUser->getId();
44 - $conds[] = 'mah_user_ip IS NULL';
 44+ $conds['mah_user_ip'] = NULL;
4545 }
4646
4747 $status = $item->loadFromDatabase( $conds );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106966follow up to -r106843 - Use addExtensionTable() instead of addExtensionUpdate...bsitu19:07, 21 December 2011
r106985adding more condtions to the where clause to reduce table record scanbsitu21:54, 21 December 2011

Status & tagging log