r68338 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68337‎ | r68338 | r68339 >
Date:18:52, 20 June 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Do ApiQueryAllUsers per r68337 (was using while (true)..)
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryAllUsers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllUsers.php
@@ -128,9 +128,9 @@
129129 // Otherwise, the group of the new row is appended to the last entry.
130130 // The setContinue... is more complex because of this, and takes into account the higher sql limit
131131 // to make sure all rows that belong to the same user are received.
132 - //
133 - while ( true ) {
134 - $row = $db->fetchObject( $res );
 132+
 133+ $row = $db->fetchObject( $res );
 134+ foreach ( $res as $row ) {
135135 $count++;
136136
137137 if ( !$row || $lastUser !== $row->user_name ) {
@@ -145,11 +145,6 @@
146146 }
147147 }
148148
149 - // No more rows left
150 - if ( !$row ) {
151 - break;
152 - }
153 -
154149 if ( $count > $limit ) {
155150 // We've reached the one extra which shows that there are additional pages to be had. Stop here...
156151 $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->user_name ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r68739Rem superfluous code, as per comments on r68338reedy20:22, 29 June 2010
r71271Followup to r68338, remove useless code (row is overwritten by loop)reedy20:34, 18 August 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r68337Per http://www.mediawiki.org/wiki/Special:Code/MediaWiki/66168#c7252 switch w...reedy18:48, 20 June 2010

Comments

#Comment by Reedy (talk | contribs)   18:53, 20 June 2010
			if ( !$row || $lastUser !== $row->user_name ) {

I'm thinking the !$row is superfluous?

#Comment by Catrope (talk | contribs)   19:37, 29 June 2010

Yes, iterating over $res will never result in an invalid $row .

Status & tagging log