r61607 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61606‎ | r61607 | r61608 >
Date:21:31, 27 January 2010
Author:ashley
Status:deferred
Tags:
Comment:
SocialProfile: while -> foreach in UserActivity
Modified paths:
  • /trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserActivity/UserActivityClass.php
@@ -83,7 +83,7 @@
8484 ORDER BY rc_id DESC LIMIT 0," . $this->item_max;
8585 $res = $dbr->query( $sql, __METHOD__ );
8686
87 - while ( $row = $dbr->fetchObject( $res ) ) {
 87+ foreach ( $res as $row ) {
8888 // Special pages aren't editable, so ignore them
8989 if ( $row->rc_namespace == NS_SPECIAL ) {
9090 continue;
@@ -145,7 +145,7 @@
146146 {$rel_sql} {$user_sql}
147147 ORDER BY vote_date DESC LIMIT 0," . $this->item_max;
148148 $res = $dbr->query( $sql, __METHOD__ );
149 - while ( $row = $dbr->fetchObject( $res ) ) {
 149+ foreach ( $res as $row ) {
150150 $username = $row->username;
151151 $this->items[] = array(
152152 'id' => 0,
@@ -190,7 +190,7 @@
191191 ORDER BY comment_date DESC LIMIT 0," . $this->item_max;
192192
193193 $res = $dbr->query( $sql, __METHOD__ );
194 - while ( $row = $dbr->fetchObject( $res ) ) {
 194+ foreach ( $res as $row ) {
195195 $show_comment = true;
196196
197197 global $wgFilterComments;
@@ -255,7 +255,7 @@
256256 {$rel_sql} {$user_sql}
257257 ORDER BY ug_id DESC LIMIT 0,{$this->item_max}";
258258 $res = $dbr->query( $sql, __METHOD__ );
259 - while ( $row = $dbr->fetchObject( $res ) ) {
 259+ foreach ( $res as $row ) {
260260 $this->items[] = array(
261261 'id' => $row->ug_id,
262262 'type' => 'gift-sent',
@@ -292,7 +292,7 @@
293293 {$rel_sql} {$user_sql}
294294 ORDER BY ug_id DESC LIMIT 0,{$this->item_max}";
295295 $res = $dbr->query( $sql, __METHOD__ );
296 - while ( $row = $dbr->fetchObject( $res ) ) {
 296+ foreach ( $res as $row ) {
297297 global $wgUploadPath;
298298 $user_title = Title::makeTitle( NS_USER, $row->ug_user_name_to );
299299 $user_title_from = Title::makeTitle( NS_USER, $row->ug_user_name_from );
@@ -352,7 +352,7 @@
353353 {$rel_sql} {$user_sql}
354354 ORDER BY sg_id DESC LIMIT 0,{$this->item_max}";
355355 $res = $dbr->query( $sql, __METHOD__ );
356 - while ( $row = $dbr->fetchObject( $res ) ) {
 356+ foreach ( $res as $row ) {
357357 global $wgUploadPath;
358358 $user_title = Title::makeTitle( NS_USER, $row->sg_user_name );
359359 $system_gift_image = '<img src="' . $wgUploadPath . '/awards/' . SystemGifts::getGiftImage( $row->gift_id, 'm' ) . '" border="0" alt="" />';
@@ -405,7 +405,7 @@
406406 ORDER BY r_id DESC LIMIT 0,{$this->item_max}";
407407 $res = $dbr->query( $sql, __METHOD__ );
408408
409 - while ( $row = $dbr->fetchObject( $res ) ) {
 409+ foreach ( $res as $row ) {
410410 if ( $row->r_type == 1 ) {
411411 $r_type = 'friend';
412412 } else {
@@ -469,7 +469,7 @@
470470 ORDER BY ub_id DESC LIMIT 0,{$this->item_max}";
471471
472472 $res = $dbr->query( $sql, __METHOD__ );
473 - while ( $row = $dbr->fetchObject( $res ) ) {
 473+ foreach ( $res as $row ) {
474474 // Ignore nonexistent (for example, renamed) users
475475 $uid = User::idFromName( $row->ub_user_name );
476476 if ( !$uid ) {
@@ -525,7 +525,7 @@
526526 {$rel_sql} {$user_sql}
527527 ORDER BY um_id DESC LIMIT 0,{$this->item_max}";
528528 $res = $dbr->query( $sql, __METHOD__ );
529 - while ( $row = $dbr->fetchObject( $res ) ) {
 529+ foreach ( $res as $row ) {
530530 $user_title = Title::makeTitle( NS_USER, $row->um_user_name );
531531 $user_name_short = substr( $row->um_user_name, 0, 15 );
532532 if ( $row->um_user_name != $user_name_short ) {

Status & tagging log