Index: trunk/extensions/MarkAsHelpful/includes/MarkAsHelpfulItem.php |
— | — | @@ -136,17 +136,8 @@ |
137 | 137 | */ |
138 | 138 | public function loadFromDatabase( $conds ) { |
139 | 139 | |
140 | | - $searchKey = array(); |
| 140 | + $searchKey = array_keys ( $conds ); |
141 | 141 | |
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 | | - |
151 | 142 | $flag = sort( $searchKey ); |
152 | 143 | |
153 | 144 | if ( !$flag ) { |
— | — | @@ -267,10 +258,10 @@ |
268 | 259 | $conds['mah_user_id'] = 0; |
269 | 260 | } else { |
270 | 261 | $conds['mah_user_id'] = $user->getId(); |
271 | | - $conds[] = 'mah_user_ip IS NULL'; |
| 262 | + $conds['mah_user_ip'] = NULL; |
272 | 263 | } |
273 | 264 | } 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 |
275 | 266 | return true; |
276 | 267 | } |
277 | 268 | |
Index: trunk/extensions/MarkAsHelpful/api/ApiMarkAsHelpful.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | $conds['mah_user_ip'] = $wgUser->getName(); |
42 | 42 | } else { |
43 | 43 | $conds['mah_user_id'] = $wgUser->getId(); |
44 | | - $conds[] = 'mah_user_ip IS NULL'; |
| 44 | + $conds['mah_user_ip'] = NULL; |
45 | 45 | } |
46 | 46 | |
47 | 47 | $status = $item->loadFromDatabase( $conds ); |