From faf34b4073594d606b742ec7ee25de90032ccd7c Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 20 Jun 2010 18:48:34 +0000 Subject: [PATCH] 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 --- includes/api/ApiPageSet.php | 6 +++--- includes/api/ApiQueryAllCategories.php | 2 +- includes/api/ApiQueryAllLinks.php | 2 +- includes/api/ApiQueryAllimages.php | 2 +- includes/api/ApiQueryAllpages.php | 2 +- includes/api/ApiQueryBacklinks.php | 4 ++-- includes/api/ApiQueryCategories.php | 4 ++-- includes/api/ApiQueryCategoryInfo.php | 2 +- includes/api/ApiQueryCategoryMembers.php | 2 +- includes/api/ApiQueryDeletedrevs.php | 2 +- includes/api/ApiQueryDuplicateFiles.php | 2 +- includes/api/ApiQueryExtLinksUsage.php | 2 +- includes/api/ApiQueryExternalLinks.php | 2 +- includes/api/ApiQueryFilearchive.php | 2 +- includes/api/ApiQueryIWBacklinks.php | 2 +- includes/api/ApiQueryIWLinks.php | 2 +- includes/api/ApiQueryImages.php | 4 ++-- includes/api/ApiQueryInfo.php | 12 ++++++------ includes/api/ApiQueryLangLinks.php | 2 +- includes/api/ApiQueryLinks.php | 4 ++-- includes/api/ApiQueryLogEvents.php | 2 +- includes/api/ApiQueryProtectedTitles.php | 2 +- includes/api/ApiQueryRandom.php | 2 +- includes/api/ApiQueryRecentChanges.php | 2 +- includes/api/ApiQueryRevisions.php | 2 +- includes/api/ApiQuerySiteinfo.php | 2 +- includes/api/ApiQueryUserContributions.php | 2 +- includes/api/ApiQueryUsers.php | 14 +++++++------- includes/api/ApiQueryWatchlist.php | 2 +- includes/api/ApiQueryWatchlistRaw.php | 2 +- 30 files changed, 47 insertions(+), 47 deletions(-) diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 554ae76839..6b54a64ff9 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -457,7 +457,7 @@ class ApiPageSet extends ApiQueryBase { 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 @@ class ApiPageSet extends ApiQueryBase { // 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 @@ class ApiPageSet extends ApiQueryBase { ); $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(); diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index be2d9cf4b6..11c843a168 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -86,7 +86,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { $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 diff --git a/includes/api/ApiQueryAllLinks.php b/includes/api/ApiQueryAllLinks.php index ced7e0c535..e1a56d72e4 100644 --- a/includes/api/ApiQueryAllLinks.php +++ b/includes/api/ApiQueryAllLinks.php @@ -111,7 +111,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase { $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 diff --git a/includes/api/ApiQueryAllimages.php b/includes/api/ApiQueryAllimages.php index b8946e8331..5b97e40f7e 100644 --- a/includes/api/ApiQueryAllimages.php +++ b/includes/api/ApiQueryAllimages.php @@ -113,7 +113,7 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase { $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 diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index 61f3414156..20630d9b70 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -150,7 +150,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $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 diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 4faba6f86f..d1b0e2a6ed 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -213,7 +213,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $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 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $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 diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index fb7bd14dba..907cbb5ccb 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.php @@ -130,7 +130,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { 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 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { } } 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... diff --git a/includes/api/ApiQueryCategoryInfo.php b/includes/api/ApiQueryCategoryInfo.php index 17ddf0c0db..c599fb2f7b 100644 --- a/includes/api/ApiQueryCategoryInfo.php +++ b/includes/api/ApiQueryCategoryInfo.php @@ -78,7 +78,7 @@ class ApiQueryCategoryInfo extends ApiQueryBase { $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; diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index 479a804f35..3dad9e2489 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -110,7 +110,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { $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 diff --git a/includes/api/ApiQueryDeletedrevs.php b/includes/api/ApiQueryDeletedrevs.php index 47406211c6..6eb8ded882 100644 --- a/includes/api/ApiQueryDeletedrevs.php +++ b/includes/api/ApiQueryDeletedrevs.php @@ -182,7 +182,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase { $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' ) { diff --git a/includes/api/ApiQueryDuplicateFiles.php b/includes/api/ApiQueryDuplicateFiles.php index 494ea09550..d926a1303f 100644 --- a/includes/api/ApiQueryDuplicateFiles.php +++ b/includes/api/ApiQueryDuplicateFiles.php @@ -92,7 +92,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { $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... diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index c17f0af445..f983f776a5 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -113,7 +113,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { $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 ); diff --git a/includes/api/ApiQueryExternalLinks.php b/includes/api/ApiQueryExternalLinks.php index bc33f3399f..7dfbadb707 100644 --- a/includes/api/ApiQueryExternalLinks.php +++ b/includes/api/ApiQueryExternalLinks.php @@ -67,7 +67,7 @@ class ApiQueryExternalLinks extends ApiQueryBase { $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... diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index 08a75e3346..fb422c756e 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -120,7 +120,7 @@ class ApiQueryFilearchive extends ApiQueryBase { $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 diff --git a/includes/api/ApiQueryIWBacklinks.php b/includes/api/ApiQueryIWBacklinks.php index bc4c6cd6a9..99d3391991 100644 --- a/includes/api/ApiQueryIWBacklinks.php +++ b/includes/api/ApiQueryIWBacklinks.php @@ -87,7 +87,7 @@ class ApiQueryIWBacklinks extends ApiQueryBase { $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 diff --git a/includes/api/ApiQueryIWLinks.php b/includes/api/ApiQueryIWLinks.php index b932c1185c..b8c440d0ba 100644 --- a/includes/api/ApiQueryIWLinks.php +++ b/includes/api/ApiQueryIWLinks.php @@ -84,7 +84,7 @@ class ApiQueryIWLinks extends ApiQueryBase { $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... diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index 1804ce4f3c..1d85a77092 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -88,7 +88,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase { 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 @@ class ApiQueryImages extends ApiQueryGeneratorBase { } 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... diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 15bb1a85f8..d86aeb4f1b 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -369,7 +369,7 @@ class ApiQueryInfo extends ApiQueryBase { $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 @@ class ApiQueryInfo extends ApiQueryBase { $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 @@ class ApiQueryInfo extends ApiQueryBase { $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 @@ class ApiQueryInfo extends ApiQueryBase { $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 @@ class ApiQueryInfo extends ApiQueryBase { $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 @@ class ApiQueryInfo extends ApiQueryBase { $res = $this->select( __METHOD__ ); - while ( $row = $db->fetchObject( $res ) ) { + foreach ( $res as $row ) { $this->watched[$row->page_namespace][$row->page_title] = true; } } diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index d4fc38fdd3..31f1e171ee 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -79,7 +79,7 @@ class ApiQueryLangLinks extends ApiQueryBase { $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... diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 5f5cf92cdb..6c08521dd3 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -143,7 +143,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { 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 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { } 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... diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 28587266f6..1aed1badc9 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -154,7 +154,7 @@ class ApiQueryLogEvents extends ApiQueryBase { $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 ) ); diff --git a/includes/api/ApiQueryProtectedTitles.php b/includes/api/ApiQueryProtectedTitles.php index 0162b8899e..986bf43561 100644 --- a/includes/api/ApiQueryProtectedTitles.php +++ b/includes/api/ApiQueryProtectedTitles.php @@ -77,7 +77,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { $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 ) ); diff --git a/includes/api/ApiQueryRandom.php b/includes/api/ApiQueryRandom.php index 5085b9e261..a6c2fa123b 100644 --- a/includes/api/ApiQueryRandom.php +++ b/includes/api/ApiQueryRandom.php @@ -67,7 +67,7 @@ if ( !defined( 'MEDIAWIKI' ) ) { $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 diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index ae2bef029f..3343e7101e 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -252,7 +252,7 @@ class ApiQueryRecentChanges extends ApiQueryBase { $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 ) ); diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 93cc2a18ca..885db47611 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -322,7 +322,7 @@ class ApiQueryRevisions extends ApiQueryBase { $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 ) { diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index f4e664575c..718ffb193b 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -257,7 +257,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { $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' ) { diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index a337c1d7d5..5b00dc3039 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -91,7 +91,7 @@ class ApiQueryContributions extends ApiQueryBase { $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 ) { diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 4301f2b153..4832da5702 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -126,8 +126,8 @@ if ( !defined( 'MEDIAWIKI' ) ) { $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 @@ if ( !defined( 'MEDIAWIKI' ) ) { $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() ) { diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index b02f6ecda9..dac68b53b6 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -178,7 +178,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $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 ) ); diff --git a/includes/api/ApiQueryWatchlistRaw.php b/includes/api/ApiQueryWatchlistRaw.php index b2a97f9ff1..1f2f4addef 100644 --- a/includes/api/ApiQueryWatchlistRaw.php +++ b/includes/api/ApiQueryWatchlistRaw.php @@ -96,7 +96,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase { $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 . '|' . -- 2.20.1