http://www.mediawiki.org/wiki/Special:Code/MediaWiki/68337

Revision: 68337
Author:   reedy
Date:     2010-06-20 18:48:34 +0000 (Sun, 20 Jun 2010)

Log Message:
-----------
Per http://www.mediawiki.org/wiki/Special:Code/MediaWiki/66168#c7252 switch 
while ( $row = $db->fectchObject( $res ) ) to foreach ( $res as row )

On ApiQueryUsers switch $r to row, and remove nested brackets

Modified Paths:
--------------
    trunk/phase3/includes/api/ApiPageSet.php
    trunk/phase3/includes/api/ApiQueryAllCategories.php
    trunk/phase3/includes/api/ApiQueryAllLinks.php
    trunk/phase3/includes/api/ApiQueryAllimages.php
    trunk/phase3/includes/api/ApiQueryAllpages.php
    trunk/phase3/includes/api/ApiQueryBacklinks.php
    trunk/phase3/includes/api/ApiQueryCategories.php
    trunk/phase3/includes/api/ApiQueryCategoryInfo.php
    trunk/phase3/includes/api/ApiQueryCategoryMembers.php
    trunk/phase3/includes/api/ApiQueryDeletedrevs.php
    trunk/phase3/includes/api/ApiQueryDuplicateFiles.php
    trunk/phase3/includes/api/ApiQueryExtLinksUsage.php
    trunk/phase3/includes/api/ApiQueryExternalLinks.php
    trunk/phase3/includes/api/ApiQueryFilearchive.php
    trunk/phase3/includes/api/ApiQueryIWBacklinks.php
    trunk/phase3/includes/api/ApiQueryIWLinks.php
    trunk/phase3/includes/api/ApiQueryImages.php
    trunk/phase3/includes/api/ApiQueryInfo.php
    trunk/phase3/includes/api/ApiQueryLangLinks.php
    trunk/phase3/includes/api/ApiQueryLinks.php
    trunk/phase3/includes/api/ApiQueryLogEvents.php
    trunk/phase3/includes/api/ApiQueryProtectedTitles.php
    trunk/phase3/includes/api/ApiQueryRandom.php
    trunk/phase3/includes/api/ApiQueryRecentChanges.php
    trunk/phase3/includes/api/ApiQueryRevisions.php
    trunk/phase3/includes/api/ApiQuerySiteinfo.php
    trunk/phase3/includes/api/ApiQueryUserContributions.php
    trunk/phase3/includes/api/ApiQueryUsers.php
    trunk/phase3/includes/api/ApiQueryWatchlist.php
    trunk/phase3/includes/api/ApiQueryWatchlistRaw.php

Modified: trunk/phase3/includes/api/ApiPageSet.php
===================================================================
--- trunk/phase3/includes/api/ApiPageSet.php    2010-06-20 18:14:50 UTC (rev 
68336)
+++ trunk/phase3/includes/api/ApiPageSet.php    2010-06-20 18:48:34 UTC (rev 
68337)
@@ -457,7 +457,7 @@
                        ApiBase::dieDebug( __METHOD__, 'Missing $processTitles 
parameter when $remaining is provided' );
                }
 
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $pageId = intval( $row->page_id );
 
                        // Remove found page from the list of remaining items
@@ -519,7 +519,7 @@
                // Get pageIDs data from the `page` table
                $this->profileDBIn();
                $res = $db->select( $tables, $fields, $where,  __METHOD__ );
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $revid = intval( $row->rev_id );
                        $pageid = intval( $row->rev_page );
                        $this->mGoodRevIDs[$revid] = $pageid;
@@ -594,7 +594,7 @@
                );
                $this->profileDBOut();
 
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $rdfrom = intval( $row->rd_from );
                        $from = 
$this->mPendingRedirectIDs[$rdfrom]->getPrefixedText();
                        $to = Title::makeTitle( $row->rd_namespace, 
$row->rd_title )->getPrefixedText();

Modified: trunk/phase3/includes/api/ApiQueryAllCategories.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryAllCategories.php 2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryAllCategories.php 2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -86,7 +86,7 @@
                $categories = array();
                $result = $this->getResult();
                $count = 0;
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $params['limit'] ) {
                                // We've reached the one extra which shows that 
there are additional cats to be had. Stop here...
                                // TODO: Security issue - if the user has no 
right to view next title, it will still be shown

Modified: trunk/phase3/includes/api/ApiQueryAllLinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryAllLinks.php      2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryAllLinks.php      2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -111,7 +111,7 @@
                $pageids = array();
                $count = 0;
                $result = $this->getResult();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $limit ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                // TODO: Security issue - if the user has no 
right to view next title, it will still be shown

Modified: trunk/phase3/includes/api/ApiQueryAllimages.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryAllimages.php     2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryAllimages.php     2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -113,7 +113,7 @@
                $titles = array();
                $count = 0;
                $result = $this->getResult();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $limit ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                // TODO: Security issue - if the user has no 
right to view next title, it will still be shown

Modified: trunk/phase3/includes/api/ApiQueryAllpages.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryAllpages.php      2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryAllpages.php      2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -150,7 +150,7 @@
 
                $count = 0;
                $result = $this->getResult();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $limit ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                // TODO: Security issue - if the user has no 
right to view next title, it will still be shown

Modified: trunk/phase3/includes/api/ApiQueryBacklinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryBacklinks.php     2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryBacklinks.php     2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -213,7 +213,7 @@
                $this->pageMap = array(); // Maps ns and title to pageid
                $this->continueStr = null;
                $this->redirTitles = array();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $this->params['limit'] ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                // Continue string preserved in case the 
redirect query doesn't pass the limit
@@ -238,7 +238,7 @@
                        $this->prepareSecondQuery( $resultPageSet );
                        $res = $this->select( __METHOD__ . '::secondQuery' );
                        $count = 0;
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                if ( ++$count > $this->params['limit'] ) {
                                        // We've reached the one extra which 
shows that there are additional pages to be had. Stop here...
                                        // We need to keep the parent page of 
this redir in

Modified: trunk/phase3/includes/api/ApiQueryCategories.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryCategories.php    2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryCategories.php    2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -130,7 +130,7 @@
 
                if ( is_null( $resultPageSet ) ) {
                        $count = 0;
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                if ( ++$count > $params['limit'] ) {
                                        // We've reached the one extra which 
shows that
                                        // there are additional pages to be 
had. Stop here...
@@ -161,7 +161,7 @@
                        }
                } else {
                        $titles = array();
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                if ( ++$count > $params['limit'] ) {
                                        // We've reached the one extra which 
shows that
                                        // there are additional pages to be 
had. Stop here...

Modified: trunk/phase3/includes/api/ApiQueryCategoryInfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryCategoryInfo.php  2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryCategoryInfo.php  2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -78,7 +78,7 @@
                $res = $this->select( __METHOD__ );
 
                $catids = array_flip( $cattitles );
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $vals = array();
                        $vals['size'] = intval( $row->cat_pages );
                        $vals['pages'] = $row->cat_pages - $row->cat_subcats - 
$row->cat_files;

Modified: trunk/phase3/includes/api/ApiQueryCategoryMembers.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryCategoryMembers.php       2010-06-20 
18:14:50 UTC (rev 68336)
+++ trunk/phase3/includes/api/ApiQueryCategoryMembers.php       2010-06-20 
18:48:34 UTC (rev 68337)
@@ -110,7 +110,7 @@
                $count = 0;
                $lastSortKey = null;
                $res = $this->select( __METHOD__ );
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $limit ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                // TODO: Security issue - if the user has no 
right to view next title, it will still be shown

Modified: trunk/phase3/includes/api/ApiQueryDeletedrevs.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryDeletedrevs.php   2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryDeletedrevs.php   2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -182,7 +182,7 @@
                $pageMap = array(); // Maps ns&title to (fake) pageid
                $count = 0;
                $newPageID = 0;
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
                                // We've had enough
                                if ( $mode == 'all' || $mode == 'revs' ) {

Modified: trunk/phase3/includes/api/ApiQueryDuplicateFiles.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryDuplicateFiles.php        2010-06-20 
18:14:50 UTC (rev 68336)
+++ trunk/phase3/includes/api/ApiQueryDuplicateFiles.php        2010-06-20 
18:48:34 UTC (rev 68337)
@@ -92,7 +92,7 @@
                $db = $this->getDB();
                $count = 0;
                $titles = array();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
                                // We've reached the one extra which shows that
                                // there are additional pages to be had. Stop 
here...

Modified: trunk/phase3/includes/api/ApiQueryExtLinksUsage.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryExtLinksUsage.php 2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryExtLinksUsage.php 2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -113,7 +113,7 @@
 
                $result = $this->getResult();
                $count = 0;
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $limit ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'offset', 
$offset + $limit );

Modified: trunk/phase3/includes/api/ApiQueryExternalLinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryExternalLinks.php 2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryExternalLinks.php 2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -67,7 +67,7 @@
                $res = $this->select( __METHOD__ );
 
                $count = 0;
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
                                // We've reached the one extra which shows that
                                // there are additional pages to be had. Stop 
here...

Modified: trunk/phase3/includes/api/ApiQueryFilearchive.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryFilearchive.php   2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryFilearchive.php   2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -120,7 +120,7 @@
                $titles = array();
                $count = 0;
                $result = $this->getResult();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                // TODO: Security issue - if the user has no 
right to view next title, it will still be shown

Modified: trunk/phase3/includes/api/ApiQueryIWBacklinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryIWBacklinks.php   2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryIWBacklinks.php   2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -87,7 +87,7 @@
 
                $count = 0;
                $result = $this->getResult();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $params['limit'] ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                // Continue string preserved in case the 
redirect query doesn't pass the limit

Modified: trunk/phase3/includes/api/ApiQueryIWLinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryIWLinks.php       2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryIWLinks.php       2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -84,7 +84,7 @@
 
                $count = 0;
                $db = $this->getDB();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
                                // We've reached the one extra which shows that
                                // there are additional pages to be had. Stop 
here...

Modified: trunk/phase3/includes/api/ApiQueryImages.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryImages.php        2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryImages.php        2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -88,7 +88,7 @@
 
                if ( is_null( $resultPageSet ) ) {
                        $count = 0;
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                if ( ++$count > $params['limit'] ) {
                                        // We've reached the one extra which 
shows that
                                        // there are additional pages to be 
had. Stop here...
@@ -108,7 +108,7 @@
                } else {
                        $titles = array();
                        $count = 0;
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $result as $row ) {
                                if ( ++$count > $params['limit'] ) {
                                        // We've reached the one extra which 
shows that
                                        // there are additional pages to be 
had. Stop here...

Modified: trunk/phase3/includes/api/ApiQueryInfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryInfo.php  2010-06-20 18:14:50 UTC (rev 
68336)
+++ trunk/phase3/includes/api/ApiQueryInfo.php  2010-06-20 18:48:34 UTC (rev 
68337)
@@ -369,7 +369,7 @@
                        $this->addWhereFld( 'pr_page', array_keys( 
$this->titles ) );
 
                        $res = $this->select( __METHOD__ );
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                $a = array(
                                        'type' => $row->pr_type,
                                        'level' => $row->pr_level,
@@ -426,7 +426,7 @@
                        $this->addFields( array( 'pt_title', 'pt_namespace', 
'pt_create_perm', 'pt_expiry' ) );
                        $this->addWhere( $lb->constructSet( 'pt', $db ) );
                        $res = $this->select( __METHOD__ );
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                
$this->protections[$row->pt_namespace][$row->pt_title][] = array(
                                        'type' => 'create',
                                        'level' => $row->pt_create_perm,
@@ -459,7 +459,7 @@
                        $this->addWhereFld( 'pr_cascade', 1 );
 
                        $res = $this->select( __METHOD__ );
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                $source = Title::makeTitle( 
$row->page_namespace, $row->page_title );
                                
$this->protections[$row->tl_namespace][$row->tl_title][] = array(
                                        'type' => $row->pr_type,
@@ -482,7 +482,7 @@
                        $this->addWhereFld( 'il_to', $images );
 
                        $res = $this->select( __METHOD__ );
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                $source = Title::makeTitle( 
$row->page_namespace, $row->page_title );
                                $this->protections[NS_FILE][$row->il_to][] = 
array(
                                        'type' => $row->pr_type,
@@ -522,7 +522,7 @@
                $this->addFields( array( 'page_title', 'page_namespace', 
'page_id' ) );
                $this->addWhere( $lb->constructSet( 'page', $db ) );
                $res = $this->select( __METHOD__ );
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( MWNamespace::isTalk( $row->page_namespace ) ) {
                                $this->talkids[MWNamespace::getSubject( 
$row->page_namespace )][$row->page_title] =
                                                intval( $row->page_id );
@@ -560,7 +560,7 @@
 
                $res = $this->select( __METHOD__ );
 
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $this->watched[$row->page_namespace][$row->page_title] 
= true;
                }
        }

Modified: trunk/phase3/includes/api/ApiQueryLangLinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryLangLinks.php     2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryLangLinks.php     2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -79,7 +79,7 @@
 
                $count = 0;
                $db = $this->getDB();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
                                // We've reached the one extra which shows that
                                // there are additional pages to be had. Stop 
here...

Modified: trunk/phase3/includes/api/ApiQueryLinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryLinks.php 2010-06-20 18:14:50 UTC (rev 
68336)
+++ trunk/phase3/includes/api/ApiQueryLinks.php 2010-06-20 18:48:34 UTC (rev 
68337)
@@ -143,7 +143,7 @@
 
                if ( is_null( $resultPageSet ) ) {
                        $count = 0;
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                if ( ++$count > $params['limit'] ) {
                                        // We've reached the one extra which 
shows that
                                        // there are additional pages to be 
had. Stop here...
@@ -165,7 +165,7 @@
                } else {
                        $titles = array();
                        $count = 0;
-                       while ( $row = $db->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                if ( ++$count > $params['limit'] ) {
                                        // We've reached the one extra which 
shows that
                                        // there are additional pages to be 
had. Stop here...

Modified: trunk/phase3/includes/api/ApiQueryLogEvents.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryLogEvents.php     2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryLogEvents.php     2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -154,7 +154,7 @@
 
                $count = 0;
                $res = $this->select( __METHOD__ );
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $limit ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'start', 
wfTimestamp( TS_ISO_8601, $row->log_timestamp ) );

Modified: trunk/phase3/includes/api/ApiQueryProtectedTitles.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryProtectedTitles.php       2010-06-20 
18:14:50 UTC (rev 68336)
+++ trunk/phase3/includes/api/ApiQueryProtectedTitles.php       2010-06-20 
18:48:34 UTC (rev 68337)
@@ -77,7 +77,7 @@
 
                $count = 0;
                $result = $this->getResult();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $params['limit'] ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'start', 
wfTimestamp( TS_ISO_8601, $row->pt_timestamp ) );

Modified: trunk/phase3/includes/api/ApiQueryRandom.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryRandom.php        2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryRandom.php        2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -67,7 +67,7 @@
                $db = $this->getDB();
                $res = $this->select( __METHOD__ );
                $count = 0;
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $count++;
                        if ( is_null( $resultPageSet ) ) {
                                // Prevent duplicates

Modified: trunk/phase3/includes/api/ApiQueryRecentChanges.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryRecentChanges.php 2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryRecentChanges.php 2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -252,7 +252,7 @@
                $res = $this->select( __METHOD__ );
 
                /* Iterate through the rows, adding data extracted from them to 
our query result. */
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $params['limit'] ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'start', 
wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) );

Modified: trunk/phase3/includes/api/ApiQueryRevisions.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryRevisions.php     2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryRevisions.php     2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -322,7 +322,7 @@
                $count = 0;
                $res = $this->select( __METHOD__ );
 
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $limit ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                if ( !$enumRevMode ) {

Modified: trunk/phase3/includes/api/ApiQuerySiteinfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQuerySiteinfo.php      2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQuerySiteinfo.php      2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -257,7 +257,7 @@
 
                $data = array();
                $langNames = Language::getLanguageNames();
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $val = array();
                        $val['prefix'] = $row->iw_prefix;
                        if ( $row->iw_local == '1' ) {

Modified: trunk/phase3/includes/api/ApiQueryUserContributions.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryUserContributions.php     2010-06-20 
18:14:50 UTC (rev 68336)
+++ trunk/phase3/includes/api/ApiQueryUserContributions.php     2010-06-20 
18:48:34 UTC (rev 68337)
@@ -91,7 +91,7 @@
                $limit = $this->params['limit'];
 
                // Fetch each row
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $limit ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                if ( $this->multiUserMode ) {

Modified: trunk/phase3/includes/api/ApiQueryUsers.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryUsers.php 2010-06-20 18:14:50 UTC (rev 
68336)
+++ trunk/phase3/includes/api/ApiQueryUsers.php 2010-06-20 18:48:34 UTC (rev 
68337)
@@ -126,8 +126,8 @@
 
                        $data = array();
                        $res = $this->select( __METHOD__ );
-                       while ( ( $r = $db->fetchObject( $res ) ) ) {
-                               $user = User::newFromRow( $r );
+                       foreach ( $rowes as $row ) {
+                               $user = User::newFromRow( $row );
                                $name = $user->getName();
                                $data[$name]['name'] = $name;
 
@@ -139,14 +139,14 @@
                                        $data[$name]['registration'] = 
wfTimestampOrNull( TS_ISO_8601, $user->getRegistration() );
                                }
 
-                               if ( isset( $this->prop['groups'] ) && 
!is_null( $r->ug_group ) ) {
+                               if ( isset( $this->prop['groups'] ) && 
!is_null( $row->ug_group ) ) {
                                        // This row contains only one group, 
others will be added from other rows
-                                       $data[$name]['groups'][] = $r->ug_group;
+                                       $data[$name]['groups'][] = 
$row->ug_group;
                                }
 
-                               if ( isset( $this->prop['blockinfo'] ) && 
!is_null( $r->blocker_name ) ) {
-                                       $data[$name]['blockedby'] = 
$r->blocker_name;
-                                       $data[$name]['blockreason'] = 
$r->ipb_reason;
+                               if ( isset( $this->prop['blockinfo'] ) && 
!is_null( $row->blocker_name ) ) {
+                                       $data[$name]['blockedby'] = 
$row->blocker_name;
+                                       $data[$name]['blockreason'] = 
$row->ipb_reason;
                                }
 
                                if ( isset( $this->prop['emailable'] ) && 
$user->canReceiveEmail() ) {

Modified: trunk/phase3/includes/api/ApiQueryWatchlist.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryWatchlist.php     2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryWatchlist.php     2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -178,7 +178,7 @@
                $count = 0;
                $res = $this->select( __METHOD__ );
 
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++ $count > $params['limit'] ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'start', 
wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) );

Modified: trunk/phase3/includes/api/ApiQueryWatchlistRaw.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryWatchlistRaw.php  2010-06-20 18:14:50 UTC 
(rev 68336)
+++ trunk/phase3/includes/api/ApiQueryWatchlistRaw.php  2010-06-20 18:48:34 UTC 
(rev 68337)
@@ -96,7 +96,7 @@
                $db = $this->getDB();
                $titles = array();
                $count = 0;
-               while ( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
                                // We've reached the one extra which shows that 
there are additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'continue', 
$row->wl_namespace . '|' .



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to