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
This commit is contained in:
Sam Reed 2010-06-20 18:48:34 +00:00
parent e19087423a
commit faf34b4073
30 changed files with 47 additions and 47 deletions

View file

@ -457,7 +457,7 @@ class ApiPageSet extends ApiQueryBase {
ApiBase::dieDebug( __METHOD__, 'Missing $processTitles parameter when $remaining is provided' ); ApiBase::dieDebug( __METHOD__, 'Missing $processTitles parameter when $remaining is provided' );
} }
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$pageId = intval( $row->page_id ); $pageId = intval( $row->page_id );
// Remove found page from the list of remaining items // Remove found page from the list of remaining items
@ -519,7 +519,7 @@ class ApiPageSet extends ApiQueryBase {
// Get pageIDs data from the `page` table // Get pageIDs data from the `page` table
$this->profileDBIn(); $this->profileDBIn();
$res = $db->select( $tables, $fields, $where, __METHOD__ ); $res = $db->select( $tables, $fields, $where, __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$revid = intval( $row->rev_id ); $revid = intval( $row->rev_id );
$pageid = intval( $row->rev_page ); $pageid = intval( $row->rev_page );
$this->mGoodRevIDs[$revid] = $pageid; $this->mGoodRevIDs[$revid] = $pageid;
@ -594,7 +594,7 @@ class ApiPageSet extends ApiQueryBase {
); );
$this->profileDBOut(); $this->profileDBOut();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$rdfrom = intval( $row->rd_from ); $rdfrom = intval( $row->rd_from );
$from = $this->mPendingRedirectIDs[$rdfrom]->getPrefixedText(); $from = $this->mPendingRedirectIDs[$rdfrom]->getPrefixedText();
$to = Title::makeTitle( $row->rd_namespace, $row->rd_title )->getPrefixedText(); $to = Title::makeTitle( $row->rd_namespace, $row->rd_title )->getPrefixedText();

View file

@ -86,7 +86,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
$categories = array(); $categories = array();
$result = $this->getResult(); $result = $this->getResult();
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $params['limit'] ) { if ( ++ $count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional cats to be had. Stop here... // 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 // TODO: Security issue - if the user has no right to view next title, it will still be shown

View file

@ -111,7 +111,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
$pageids = array(); $pageids = array();
$count = 0; $count = 0;
$result = $this->getResult(); $result = $this->getResult();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $limit ) { if ( ++ $count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 // TODO: Security issue - if the user has no right to view next title, it will still be shown

View file

@ -113,7 +113,7 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
$titles = array(); $titles = array();
$count = 0; $count = 0;
$result = $this->getResult(); $result = $this->getResult();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $limit ) { if ( ++ $count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 // TODO: Security issue - if the user has no right to view next title, it will still be shown

View file

@ -150,7 +150,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
$count = 0; $count = 0;
$result = $this->getResult(); $result = $this->getResult();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $limit ) { if ( ++ $count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 // TODO: Security issue - if the user has no right to view next title, it will still be shown

View file

@ -213,7 +213,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
$this->pageMap = array(); // Maps ns and title to pageid $this->pageMap = array(); // Maps ns and title to pageid
$this->continueStr = null; $this->continueStr = null;
$this->redirTitles = array(); $this->redirTitles = array();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $this->params['limit'] ) { if ( ++ $count > $this->params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 // Continue string preserved in case the redirect query doesn't pass the limit
@ -238,7 +238,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
$this->prepareSecondQuery( $resultPageSet ); $this->prepareSecondQuery( $resultPageSet );
$res = $this->select( __METHOD__ . '::secondQuery' ); $res = $this->select( __METHOD__ . '::secondQuery' );
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $this->params['limit'] ) { if ( ++$count > $this->params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 // We need to keep the parent page of this redir in

View file

@ -130,7 +130,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
if ( is_null( $resultPageSet ) ) { if ( is_null( $resultPageSet ) ) {
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...
@ -161,7 +161,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
} }
} else { } else {
$titles = array(); $titles = array();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...

View file

@ -78,7 +78,7 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
$catids = array_flip( $cattitles ); $catids = array_flip( $cattitles );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$vals = array(); $vals = array();
$vals['size'] = intval( $row->cat_pages ); $vals['size'] = intval( $row->cat_pages );
$vals['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files; $vals['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files;

View file

@ -110,7 +110,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
$count = 0; $count = 0;
$lastSortKey = null; $lastSortKey = null;
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $limit ) { if ( ++ $count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 // TODO: Security issue - if the user has no right to view next title, it will still be shown

View file

@ -182,7 +182,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
$pageMap = array(); // Maps ns&title to (fake) pageid $pageMap = array(); // Maps ns&title to (fake) pageid
$count = 0; $count = 0;
$newPageID = 0; $newPageID = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $limit ) { if ( ++$count > $limit ) {
// We've had enough // We've had enough
if ( $mode == 'all' || $mode == 'revs' ) { if ( $mode == 'all' || $mode == 'revs' ) {

View file

@ -92,7 +92,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
$db = $this->getDB(); $db = $this->getDB();
$count = 0; $count = 0;
$titles = array(); $titles = array();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...

View file

@ -113,7 +113,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
$result = $this->getResult(); $result = $this->getResult();
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $limit ) { if ( ++ $count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // We've reached the one extra which shows that there are additional pages to be had. Stop here...
$this->setContinueEnumParameter( 'offset', $offset + $limit ); $this->setContinueEnumParameter( 'offset', $offset + $limit );

View file

@ -67,7 +67,7 @@ class ApiQueryExternalLinks extends ApiQueryBase {
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...

View file

@ -120,7 +120,7 @@ class ApiQueryFilearchive extends ApiQueryBase {
$titles = array(); $titles = array();
$count = 0; $count = 0;
$result = $this->getResult(); $result = $this->getResult();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $limit ) { if ( ++$count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 // TODO: Security issue - if the user has no right to view next title, it will still be shown

View file

@ -87,7 +87,7 @@ class ApiQueryIWBacklinks extends ApiQueryBase {
$count = 0; $count = 0;
$result = $this->getResult(); $result = $this->getResult();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $params['limit'] ) { if ( ++ $count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 // Continue string preserved in case the redirect query doesn't pass the limit

View file

@ -84,7 +84,7 @@ class ApiQueryIWLinks extends ApiQueryBase {
$count = 0; $count = 0;
$db = $this->getDB(); $db = $this->getDB();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...

View file

@ -88,7 +88,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
if ( is_null( $resultPageSet ) ) { if ( is_null( $resultPageSet ) ) {
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...
@ -108,7 +108,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
} else { } else {
$titles = array(); $titles = array();
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $result as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...

View file

@ -369,7 +369,7 @@ class ApiQueryInfo extends ApiQueryBase {
$this->addWhereFld( 'pr_page', array_keys( $this->titles ) ); $this->addWhereFld( 'pr_page', array_keys( $this->titles ) );
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$a = array( $a = array(
'type' => $row->pr_type, 'type' => $row->pr_type,
'level' => $row->pr_level, '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->addFields( array( 'pt_title', 'pt_namespace', 'pt_create_perm', 'pt_expiry' ) );
$this->addWhere( $lb->constructSet( 'pt', $db ) ); $this->addWhere( $lb->constructSet( 'pt', $db ) );
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$this->protections[$row->pt_namespace][$row->pt_title][] = array( $this->protections[$row->pt_namespace][$row->pt_title][] = array(
'type' => 'create', 'type' => 'create',
'level' => $row->pt_create_perm, 'level' => $row->pt_create_perm,
@ -459,7 +459,7 @@ class ApiQueryInfo extends ApiQueryBase {
$this->addWhereFld( 'pr_cascade', 1 ); $this->addWhereFld( 'pr_cascade', 1 );
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$source = Title::makeTitle( $row->page_namespace, $row->page_title ); $source = Title::makeTitle( $row->page_namespace, $row->page_title );
$this->protections[$row->tl_namespace][$row->tl_title][] = array( $this->protections[$row->tl_namespace][$row->tl_title][] = array(
'type' => $row->pr_type, 'type' => $row->pr_type,
@ -482,7 +482,7 @@ class ApiQueryInfo extends ApiQueryBase {
$this->addWhereFld( 'il_to', $images ); $this->addWhereFld( 'il_to', $images );
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$source = Title::makeTitle( $row->page_namespace, $row->page_title ); $source = Title::makeTitle( $row->page_namespace, $row->page_title );
$this->protections[NS_FILE][$row->il_to][] = array( $this->protections[NS_FILE][$row->il_to][] = array(
'type' => $row->pr_type, 'type' => $row->pr_type,
@ -522,7 +522,7 @@ class ApiQueryInfo extends ApiQueryBase {
$this->addFields( array( 'page_title', 'page_namespace', 'page_id' ) ); $this->addFields( array( 'page_title', 'page_namespace', 'page_id' ) );
$this->addWhere( $lb->constructSet( 'page', $db ) ); $this->addWhere( $lb->constructSet( 'page', $db ) );
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( MWNamespace::isTalk( $row->page_namespace ) ) { if ( MWNamespace::isTalk( $row->page_namespace ) ) {
$this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] = $this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] =
intval( $row->page_id ); intval( $row->page_id );
@ -560,7 +560,7 @@ class ApiQueryInfo extends ApiQueryBase {
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$this->watched[$row->page_namespace][$row->page_title] = true; $this->watched[$row->page_namespace][$row->page_title] = true;
} }
} }

View file

@ -79,7 +79,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
$count = 0; $count = 0;
$db = $this->getDB(); $db = $this->getDB();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...

View file

@ -143,7 +143,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
if ( is_null( $resultPageSet ) ) { if ( is_null( $resultPageSet ) ) {
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...
@ -165,7 +165,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
} else { } else {
$titles = array(); $titles = array();
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that // We've reached the one extra which shows that
// there are additional pages to be had. Stop here... // there are additional pages to be had. Stop here...

View file

@ -154,7 +154,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
$count = 0; $count = 0;
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $limit ) { if ( ++ $count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 ) ); $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->log_timestamp ) );

View file

@ -77,7 +77,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
$count = 0; $count = 0;
$result = $this->getResult(); $result = $this->getResult();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $params['limit'] ) { if ( ++ $count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 ) ); $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->pt_timestamp ) );

View file

@ -67,7 +67,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
$db = $this->getDB(); $db = $this->getDB();
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$count++; $count++;
if ( is_null( $resultPageSet ) ) { if ( is_null( $resultPageSet ) ) {
// Prevent duplicates // Prevent duplicates

View file

@ -252,7 +252,7 @@ class ApiQueryRecentChanges extends ApiQueryBase {
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
/* Iterate through the rows, adding data extracted from them to our query result. */ /* 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'] ) { if ( ++ $count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 ) ); $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) );

View file

@ -322,7 +322,7 @@ class ApiQueryRevisions extends ApiQueryBase {
$count = 0; $count = 0;
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $limit ) { if ( ++ $count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // We've reached the one extra which shows that there are additional pages to be had. Stop here...
if ( !$enumRevMode ) { if ( !$enumRevMode ) {

View file

@ -257,7 +257,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
$data = array(); $data = array();
$langNames = Language::getLanguageNames(); $langNames = Language::getLanguageNames();
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
$val = array(); $val = array();
$val['prefix'] = $row->iw_prefix; $val['prefix'] = $row->iw_prefix;
if ( $row->iw_local == '1' ) { if ( $row->iw_local == '1' ) {

View file

@ -91,7 +91,7 @@ class ApiQueryContributions extends ApiQueryBase {
$limit = $this->params['limit']; $limit = $this->params['limit'];
// Fetch each row // Fetch each row
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $limit ) { if ( ++ $count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // We've reached the one extra which shows that there are additional pages to be had. Stop here...
if ( $this->multiUserMode ) { if ( $this->multiUserMode ) {

View file

@ -126,8 +126,8 @@ if ( !defined( 'MEDIAWIKI' ) ) {
$data = array(); $data = array();
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( ( $r = $db->fetchObject( $res ) ) ) { foreach ( $rowes as $row ) {
$user = User::newFromRow( $r ); $user = User::newFromRow( $row );
$name = $user->getName(); $name = $user->getName();
$data[$name]['name'] = $name; $data[$name]['name'] = $name;
@ -139,14 +139,14 @@ if ( !defined( 'MEDIAWIKI' ) ) {
$data[$name]['registration'] = wfTimestampOrNull( TS_ISO_8601, $user->getRegistration() ); $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 // 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 ) ) { if ( isset( $this->prop['blockinfo'] ) && !is_null( $row->blocker_name ) ) {
$data[$name]['blockedby'] = $r->blocker_name; $data[$name]['blockedby'] = $row->blocker_name;
$data[$name]['blockreason'] = $r->ipb_reason; $data[$name]['blockreason'] = $row->ipb_reason;
} }
if ( isset( $this->prop['emailable'] ) && $user->canReceiveEmail() ) { if ( isset( $this->prop['emailable'] ) && $user->canReceiveEmail() ) {

View file

@ -178,7 +178,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
$count = 0; $count = 0;
$res = $this->select( __METHOD__ ); $res = $this->select( __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++ $count > $params['limit'] ) { if ( ++ $count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // 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 ) ); $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) );

View file

@ -96,7 +96,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
$db = $this->getDB(); $db = $this->getDB();
$titles = array(); $titles = array();
$count = 0; $count = 0;
while ( $row = $db->fetchObject( $res ) ) { foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) { if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here... // We've reached the one extra which shows that there are additional pages to be had. Stop here...
$this->setContinueEnumParameter( 'continue', $row->wl_namespace . '|' . $this->setContinueEnumParameter( 'continue', $row->wl_namespace . '|' .