r75677 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75676‎ | r75677 | r75678 >
Date:21:30, 29 October 2010
Author:reedy
Status:deferred (Comments)
Tags:
Comment:
Conditionals in loops to foreachs
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.hooks.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilterVariableHolder.php (modified) (history)
  • /trunk/extensions/AbuseFilter/ApiQueryAbuseFilters.php (modified) (history)
  • /trunk/extensions/AbuseFilter/ApiQueryAbuseLog.php (modified) (history)
  • /trunk/extensions/CategoryTree/CategoryTreeFunctions.php (modified) (history)
  • /trunk/extensions/CentralAuth/CentralAuthUser.php (modified) (history)
  • /trunk/extensions/CentralAuth/SpecialGlobalGroupPermissions.php (modified) (history)
  • /trunk/extensions/CentralAuth/SpecialGlobalUsers.php (modified) (history)
  • /trunk/extensions/CentralAuth/WikiSet.php (modified) (history)
  • /trunk/extensions/CheckUser/CheckUser_body.php (modified) (history)
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)
  • /trunk/extensions/CommunityVoice/Modules/Ratings.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ConfirmEdit_body.php (modified) (history)
  • /trunk/extensions/ContributionReporting/FundraiserStatistics_body.php (modified) (history)
  • /trunk/extensions/ContributionScores/ContributionScores_body.php (modified) (history)
  • /trunk/extensions/DynamicPageList/DPLMain.php (modified) (history)
  • /trunk/extensions/GlobalBlocking/ApiQueryGlobalBlocks.php (modified) (history)
  • /trunk/extensions/MWSearch/luceneUpdate.php (modified) (history)
  • /trunk/extensions/Nuke/Nuke_body.php (modified) (history)
  • /trunk/extensions/Oversight/HideRevision_body.php (modified) (history)
  • /trunk/extensions/ProofreadPage/ProofreadPage_body.php (modified) (history)
  • /trunk/extensions/ReaderFeedback/ReaderFeedback.class.php (modified) (history)
  • /trunk/extensions/ReaderFeedback/specialpages/RatedPages_body.php (modified) (history)
  • /trunk/extensions/ReaderFeedback/specialpages/RatingHistory_body.php (modified) (history)
  • /trunk/extensions/Renameuser/Renameuser_body.php (modified) (history)
  • /trunk/extensions/SpamBlacklist/SpamBlacklist_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionScores/ContributionScores_body.php
@@ -102,7 +102,7 @@
103103
104104 $skin = $wgUser->getSkin();
105105 $altrow = '';
106 - while ( $row = $dbr->fetchObject( $res ) ) {
 106+ foreach ( $res as $row ) {
107107 $output .= "</tr><tr class='{$altrow}'>\n<td class='content'>" .
108108 round($row->wiki_rank,0) . "\n</td><td class='content'>" .
109109 $row->page_count . "\n</td><td class='content'>" .
Index: trunk/extensions/Collection/Collection.body.php
@@ -694,7 +694,7 @@
695695
696696 $count = 0;
697697 $limitExceeded = false;
698 - while ( $row = $db->fetchObject( $res ) ) {
 698+ foreach ( $res as $row ) {
699699 if ( ++$count > $limit ) {
700700 $limitExceeded = true;
701701 break;
Index: trunk/extensions/Renameuser/Renameuser_body.php
@@ -311,7 +311,7 @@
312312
313313 $output = '';
314314 $skin = $wgUser->getSkin();
315 - while ( $row = $dbr->fetchObject( $pages ) ) {
 315+ foreach ( $pages as $row ) {
316316 $oldPage = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
317317 $newPage = Title::makeTitleSafe( $row->page_namespace,
318318 preg_replace( '!^[^/]+!', $newusername->getDBkey(), $row->page_title ) );
Index: trunk/extensions/Oversight/HideRevision_body.php
@@ -131,7 +131,7 @@
132132 $changes = ChangesList::newFromUser( $wgUser );
133133
134134 $out = $changes->beginRecentChangesList();
135 - while( $row = $resultSet->fetchObject() ) {
 135+ foreach ( $resultSet as $row ) {
136136 $rc = RecentChange::newFromCurRow( $row );
137137 $rc->counter = 0; // ???
138138 $out .= $changes->recentChangesLine( $rc );
@@ -488,7 +488,7 @@
489489 $dbr = wfGetDB( DB_SLAVE );
490490 $result = $this->getRevisions( $dbr, array( 'hidden_rev_id' => $revision ) );
491491
492 - while( $row = $dbr->fetchObject( $result ) ) {
 492+ foreach ( $result as $row ) {
493493 $info = $this->listRow( $row );
494494 $list = $this->revisionInfo( $row );
495495 $rev = new Revision( $row );
@@ -534,7 +534,7 @@
535535 $dbr = wfGetDB( DB_SLAVE );
536536 $result = $this->getRevisions( $dbr, array( 'hidden_rev_id' => $revision ) );
537537
538 - while( $row = $dbr->fetchObject( $result ) ) {
 538+ foreach ( $result as $row ) {
539539 $info = $this->listRow( $row );
540540 $list = $this->revisionInfo( $row );
541541 $rev = new Revision( $row );
@@ -643,7 +643,7 @@
644644 wfProfileIn( __METHOD__ );
645645 # Do a link batch query
646646 $lb = new LinkBatch();
647 - while( $row = $this->mResult->fetchObject() ) {
 647+ foreach ( $this->mResult as $row ) {
648648 $lb->add( $row->page_namespace, $row->page_title );
649649 }
650650 $lb->execute();
Index: trunk/extensions/CommunityVoice/Modules/Ratings.php
@@ -40,7 +40,7 @@
4141 array( 'vot_category' => $category )
4242 );
4343 $titles = array();
44 - while ( $row = $result->fetchRow() ) {
 44+ foreach ( $result as $row ) {
4545 $titles[] = (string)$row['vot_title'];
4646 }
4747 return $titles;
Index: trunk/extensions/ConfirmEdit/ConfirmEdit_body.php
@@ -484,7 +484,7 @@
485485 $res = $dbr->select( 'externallinks', array( 'el_to' ),
486486 array( 'el_from' => $id ), __METHOD__ );
487487 $links = array();
488 - while ( $row = $dbr->fetchObject( $res ) ) {
 488+ foreach ( $res as $row ) {
489489 $links[] = $row->el_to;
490490 }
491491 return $links;
Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php
@@ -152,7 +152,7 @@
153153 __METHOD__
154154 );
155155
156 - while ( $x = $dbr->fetchObject( $result ) ) {
 156+ foreach ( $result as $x ) {
157157 $ref_title = Title::makeTitle( $x->page_namespace, $x->page_title );
158158 if ( preg_match( "/^$index_namespace:(.*)$/", $ref_title->getPrefixedText() ) ) {
159159 $title->pr_index_title = $ref_title->getPrefixedText();
@@ -488,7 +488,7 @@
489489 $query .= ')';
490490 $res = $dbr->query( $query, __METHOD__ );
491491
492 - while ( $x = $dbr->fetchObject( $res ) ) {
 492+ foreach ( $res as $x ) {
493493 $pdbk = $page_ids[$x->cl_from];
494494 switch( $x->cl_to ) {
495495 case str_replace( ' ' , '_' , wfMsgForContent( 'proofreadpage_quality0_category' ) ):
@@ -882,7 +882,7 @@
883883 );
884884
885885 if( $res ) {
886 - while( $o = $dbr->fetchObject( $res ) ) {
 886+ foreach ( $res as $o ) {
887887 array_push( $q0_pages, $o->page_title );
888888 }
889889 }
Index: trunk/extensions/GlobalBlocking/ApiQueryGlobalBlocks.php
@@ -104,8 +104,7 @@
105105 $res = $this->select(__METHOD__);
106106
107107 $count = 0;
108 - while($row = $res->fetchObject())
109 - {
 108+ foreach ( $res as $row ) {
110109 if(++$count > $params['limit'])
111110 {
112111 // We've had enough
Index: trunk/extensions/MWSearch/luceneUpdate.php
@@ -240,7 +240,7 @@
241241 $limit );
242242
243243 $errorCount = 0;
244 - while( $row = $this->dbstream->fetchObject( $result ) ) {
 244+ foreach ( $result as $row ) {
245245 $this->progress();
246246
247247 $title = Title::makeTitle( $row->page_namespace, $row->page_title );
@@ -304,7 +304,7 @@
305305 $this->init( $max );
306306 $lastError = true;
307307
308 - while( $row = $this->dbstream->fetchObject( $result ) ) {
 308+ foreach ( $result as $row ) {
309309 $this->progress();
310310 $title = Title::makeTitle( $row->log_namespace, $row->log_title );
311311 $hit = MWSearchUpdater::deletePage( $wgDBname, $title );
@@ -358,7 +358,7 @@
359359 $this->init( $max );
360360 $lastError = true;
361361
362 - while( $row = $this->dbstream->fetchObject( $result ) ) {
 362+ foreach ( $result as $row ) {
363363 $this->progress();
364364 $rev = new Revision( $row );
365365 if( is_object( $rev ) ) {
Index: trunk/extensions/SpamBlacklist/SpamBlacklist_body.php
@@ -287,7 +287,7 @@
288288 $res = $dbr->select( 'externallinks', array( 'el_to' ),
289289 array( 'el_from' => $id ), __METHOD__ );
290290 $links = array();
291 - while ( $row = $dbr->fetchObject( $res ) ) {
 291+ foreach ( $res as $row ) {
292292 $links[] = $row->el_to;
293293 }
294294 return $links;
Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php
@@ -524,7 +524,7 @@
525525
526526 $s = '';
527527
528 - while ( $row = $dbr->fetchObject( $res ) ) {
 528+ foreach ( $res as $row ) {
529529 # TODO: translation support; ideally added to Title object
530530 $t = Title::newFromRow( $row );
531531
Index: trunk/extensions/Nuke/Nuke_body.php
@@ -130,7 +130,7 @@
131131 )
132132 );
133133 $pages = array();
134 - while( $row = $dbr->fetchObject( $result ) ) {
 134+ foreach ( $result as $row ) {
135135 $pages[] = array( Title::makeTitle( $row->rc_namespace, $row->rc_title ), $row->edits );
136136 }
137137 $dbr->freeResult( $result );
Index: trunk/extensions/ContributionReporting/FundraiserStatistics_body.php
@@ -244,7 +244,7 @@
245245 );
246246 $result = array();
247247 $ytd = 0;
248 - while ( $row = $dbr->fetchRow( $select ) ) {
 248+ foreach ( $select as $row ) {
249249 $row[] = $ytd += $row[1]; // YTD
250250 $result[] = $row;
251251 }
Index: trunk/extensions/CentralAuth/CentralAuthUser.php
@@ -177,7 +177,7 @@
178178 );
179179
180180 $sets = array();
181 - while ( $row = $dbr->fetchObject( $resSets ) ) {
 181+ foreach ( $resSets as $row ) {
182182 $sets[$row->ggr_group] = WikiSet::newFromRow( $row );
183183 }
184184
@@ -185,7 +185,7 @@
186186 $rights = array();
187187 $groups = array();
188188
189 - while ( $row = $dbr->fetchObject( $res ) ) {
 189+ foreach ( $res as $row ) {
190190 $set = @$sets[$row->ggp_group];
191191 $rights[] = array( 'right' => $row->ggp_permission, 'set' => $set ? $set->getID() : false );
192192 $groups[$row->ggp_group] = 1;
@@ -1314,7 +1314,7 @@
13151315 $result = $dbw->safeQuery( $sql, $this->mName );
13161316
13171317 $dbs = array();
1318 - while ( $row = $dbw->fetchObject( $result ) ) {
 1318+ foreach ( $result as $row ) {
13191319 $dbs[] = $row->ln_wiki;
13201320 }
13211321 $dbw->freeResult( $result );
@@ -1432,7 +1432,7 @@
14331433 __METHOD__ );
14341434
14351435 $wikis = array();
1436 - while ( $row = $result->fetchObject() ) {
 1436+ foreach ( $result as $row ) {
14371437 $wikis[] = $row->lu_wiki;
14381438 }
14391439 $dbw->freeResult( $result );
@@ -1475,7 +1475,7 @@
14761476 __METHOD__ );
14771477
14781478 $wikis = array();
1479 - while ( $row = $dbw->fetchObject( $result ) ) {
 1479+ foreach ( $result as $row ) {
14801480 $wikis[$row->lu_wiki] = array(
14811481 'wiki' => $row->lu_wiki,
14821482 'attachedTimestamp' => wfTimestampOrNull( TS_MW,
@@ -1859,8 +1859,9 @@
18601860
18611861 $groups = array();
18621862
1863 - while ( $row = $dbr->fetchObject( $res ) )
 1863+ foreach ( $res as $row ) {
18641864 $groups[] = $row->ggp_group;
 1865+ }
18651866
18661867 return $groups;
18671868 }
@@ -1873,7 +1874,7 @@
18741875
18751876 $rights = array();
18761877
1877 - while ( $row = $dbr->fetchObject( $res ) ) {
 1878+ foreach ( $res as $row ) {
18781879 $rights[] = $row->ggp_permission;
18791880 }
18801881
@@ -1894,8 +1895,9 @@
18951896
18961897 $rights = array();
18971898
1898 - while ( $row = $dbr->fetchObject( $res ) )
 1899+ foreach ( $res as $row ) {
18991900 $rights[] = $row->ggp_permission;
 1901+ }
19001902
19011903 return $rights;
19021904 }
Index: trunk/extensions/CentralAuth/SpecialGlobalGroupPermissions.php
@@ -362,7 +362,7 @@
363363 $res = $dbr->select( array( 'global_user_groups', 'globaluser' ), 'gu_name', array( 'gug_group' => $group, 'gu_id=gug_user' ), __METHOD__ );
364364
365365 // Invalidate their rights cache.
366 - while ( $row = $res->fetchObject() ) {
 366+ foreach ( $res as $row ) {
367367 $cu = new CentralAuthUser( $row->gu_name );
368368 $cu->quickInvalidateCache();
369369 }
Index: trunk/extensions/CentralAuth/WikiSet.php
@@ -183,7 +183,7 @@
184184 $dbr = CentralAuthUser::getCentralSlaveDB();
185185 $res = $dbr->select( 'wikiset', '*', false, __METHOD__ );
186186 $result = array();
187 - while ( $row = $dbr->fetchObject( $res ) ) {
 187+ foreach ( $res as $row ) {
188188 $result[] = self::newFromRow( $row );
189189 }
190190 return $result;
Index: trunk/extensions/CentralAuth/SpecialGlobalUsers.php
@@ -124,7 +124,7 @@
125125
126126 $this->mResult->rewind();
127127
128 - while ( $row = $this->mResult->fetchObject() ) {
 128+ foreach ( $this->mResult as $row ) {
129129 $batch->addObj( Title::makeTitleSafe( NS_USER, $row->gu_name ) );
130130 }
131131 $batch->execute();
@@ -141,7 +141,7 @@
142142 }
143143 $result = $this->mDb->select( 'global_user_groups', 'gug_group', array( 'gug_user' => $row->gu_id ), __METHOD__ );
144144 $rights = array();
145 - while ( $row2 = $this->mDb->fetchObject( $result ) ) {
 145+ foreach ( $result as $row2 ) {
146146 $rights[] = User::makeGroupLinkWiki( $row2->gug_group, User::getGroupMember( $row2->gug_group ) );
147147 }
148148 return implode( ', ', $rights );
Index: trunk/extensions/AbuseFilter/ApiQueryAbuseFilters.php
@@ -97,7 +97,7 @@
9898 $showhidden = $wgUser->isAllowed( 'abusefilter-modify' );
9999
100100 $count = 0;
101 - while ( $row = $res->fetchObject() ) {
 101+ foreach ( $res as $row ) {
102102 if ( ++$count > $params['limit'] ) {
103103 // We've had enough
104104 $this->setContinueEnumParameter( 'startid', $row->af_id );
Index: trunk/extensions/AbuseFilter/AbuseFilterVariableHolder.php
@@ -330,7 +330,7 @@
331331 );
332332
333333 $users = array();
334 - while ( $user = $dbr->fetchRow( $res ) ) {
 334+ foreach ( $res as $user ) {
335335 $users[] = $user[0];
336336 }
337337 $result = $users;
Index: trunk/extensions/AbuseFilter/ApiQueryAbuseLog.php
@@ -104,7 +104,7 @@
105105 $res = $this->select( __METHOD__ );
106106
107107 $count = 0;
108 - while ( $row = $res->fetchObject() ) {
 108+ foreach ( $res as $row ) {
109109 if ( ++$count > $params['limit'] ) {
110110 // We've had enough
111111 $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->afl_timestamp ) );
Index: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php
@@ -155,7 +155,7 @@
156156 array( 'abuse_filter' => array( 'INNER JOIN', 'afa_filter=af_id' ) )
157157 );
158158
159 - while ( $row = $res->fetchObject() ) {
 159+ foreach ( $res as $row ) {
160160 $emptyTags = array_filter(
161161 array_merge( explode( "\n", $row->afa_parameters ), $emptyTags )
162162 );
Index: trunk/extensions/ReaderFeedback/specialpages/RatedPages_body.php
@@ -155,7 +155,7 @@
156156 wfProfileIn( __METHOD__ );
157157 # Do a link batch query...
158158 $lb = new LinkBatch();
159 - while( $row = $this->mResult->fetchObject() ) {
 159+ foreach ( $this->mResult as $row ) {
160160 $lb->add( $row->page_namespace, $row->page_title );
161161 }
162162 $lb->execute();
Index: trunk/extensions/ReaderFeedback/specialpages/RatingHistory_body.php
@@ -216,7 +216,7 @@
217217 // Label spacing
218218 $int = intval( ceil($days/10) ); // 10 labels at most
219219 $dates = $drating = $arating = $dcount = "";
220 - while( $row = $res->fetchObject() ) {
 220+ foreach ( $res as $row ) {
221221 $totalVal += (int)$row->rfh_total;
222222 $totalCount += (int)$row->rfh_count;
223223 $dayAve = sprintf( '%4.2f', (real)$row->rfh_total/(real)$row->rfh_count );
@@ -386,7 +386,7 @@
387387 if( !$maxC ) return false;
388388 // Label spacing
389389 $int = intval( ceil($days/10) ); // 10 labels at most
390 - while( $row = $res->fetchObject() ) {
 390+ foreach ( $res as $row ) {
391391 $totalVal += (int)$row->rfh_total;
392392 $totalCount += (int)$row->rfh_count;
393393 $dayCount = (real)$row->rfh_count;
@@ -521,7 +521,7 @@
522522 # Get max count and average rating
523523 $total = $count = $ave = $maxC = $days = 0;
524524 if( $dbr->numRows($res) > 0 ) {
525 - while( $row = $dbr->fetchObject($res) ) {
 525+ foreach ( $res as $row ) {
526526 if( !isset($lower) ) {
527527 $lower = wfTimestamp( TS_UNIX, $row->rfh_date ); // first day
528528 }
@@ -648,7 +648,7 @@
649649 $columns = 4;
650650 $count = 0;
651651 $html = "<table class='rfb-reader_feedback_users'><tr>";
652 - while( $row = $res->fetchObject() ) {
 652+ foreach ( $res as $row ) {
653653 $title = Title::makeTitleSafe( NS_USER, $row->name );
654654 if( is_null($title) ) continue; // bad IP?
655655 $html .= '<td>'.$this->skin->makeLinkObj( $title, $title->getText() )." [{$row->n}]</td>";
Index: trunk/extensions/ReaderFeedback/ReaderFeedback.class.php
@@ -208,7 +208,7 @@
209209 $votes[$tag] = array( 0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0 );
210210 }
211211 // Read votes and tally the numbers
212 - while( $row = $dbr->fetchObject($res) ) {
 212+ foreach ( $res as $row ) {
213213 $dims = ReaderFeedback::expandRatings( $row->rfb_ratings );
214214 foreach( $dims as $tag => $val ) {
215215 if( isset($votes[$tag]) && isset($votes[$tag][$val]) ) {
Index: trunk/extensions/CheckUser/CheckUser_body.php
@@ -356,7 +356,7 @@
357357 $blockip = SpecialPage::getTitleFor( 'Blockip' );
358358 $ips_edits = array();
359359 $counter = 0;
360 - while ( $row = $dbr->fetchObject( $ret ) ) {
 360+ foreach ( $ret as $row ) {
361361 if ( $counter >= 5000 ) {
362362 // FIXME: addWikiMSG
363363 $wgOut->addHTML( wfMsgExt( 'checkuser-limited', array( 'parse' ) ) );
@@ -507,7 +507,7 @@
508508 # List out each IP that has edits
509509 $s = wfMsgExt( 'checkuser-too-many', array( 'parse' ) );
510510 $s .= '<ol>';
511 - while ( $row = $ret->fetchObject() ) {
 511+ foreach ( $ret as $row ) {
512512 if ( $counter >= 5000 ) {
513513 // FIXME: addWikiMsg
514514 $wgOut->addHTML( wfMsgExt( 'checkuser-limited', array( 'parse' ) ) );
@@ -556,7 +556,7 @@
557557 $this->preCacheMessages();
558558 # Try to optimize this query
559559 $lb = new LinkBatch;
560 - while ( $row = $ret->fetchObject() ) {
 560+ foreach ( $ret as $row ) {
561561 $userText = str_replace( ' ', '_', $row->cuc_user_text );
562562 $lb->add( $row->cuc_namespace, $row->cuc_title );
563563 $lb->add( NS_USER, $userText );
@@ -566,7 +566,7 @@
567567 $ret->seek( 0 );
568568 # List out the edits
569569 $s = '<div id="checkuserresults">';
570 - while ( $row = $ret->fetchObject() ) {
 570+ foreach ( $ret as $row ) {
571571 if ( $counter >= 5000 ) {
572572 // FIXME: addWikiMsg
573573 $wgOut->addHTML( wfMsgExt( 'checkuser-limited', array( 'parse' ) ) );
@@ -645,13 +645,13 @@
646646 $ret = $dbr->query( $sql, __METHOD__ );
647647 # Try to optimize this query
648648 $lb = new LinkBatch;
649 - while ( $row = $ret->fetchObject() ) {
 649+ foreach ( $ret as $row ) {
650650 $lb->add( $row->cuc_namespace, $row->cuc_title );
651651 }
652652 $lb->execute();
653653 $ret->seek( 0 );
654654 $s = '';
655 - while ( $row = $ret->fetchObject() ) {
 655+ foreach ( $ret as $row ) {
656656 if ( !$ip = htmlspecialchars( $row->cuc_ip ) ) {
657657 continue;
658658 }
@@ -686,14 +686,14 @@
687687 } else {
688688 # Try to optimize this query
689689 $lb = new LinkBatch;
690 - while ( $row = $ret->fetchObject() ) {
 690+ foreach ( $ret as $row ) {
691691 $lb->add( $row->cuc_namespace, $row->cuc_title );
692692 }
693693 $lb->execute();
694694 $ret->seek( 0 );
695695 # List out the edits
696696 $s = '<div id="checkuserresults">';
697 - while ( $row = $ret->fetchObject() ) {
 697+ foreach ( $ret as $row ) {
698698 $s .= $this->CUChangesLine( $row, $reason );
699699 }
700700 $s .= '</ul></div>';
@@ -769,7 +769,7 @@
770770 $s = '<h5>' . wfMsg( 'checkuser-too-many' ) . '</h5>';
771771 $s .= '<ol>';
772772 $counter = 0;
773 - while ( $row = $ret->fetchObject() ) {
 773+ foreach ( $ret as $row ) {
774774 if ( $counter >= 5000 ) {
775775 $wgOut->addHTML( wfMsgExt( 'checkuser-limited', array( 'parse' ) ) );
776776 break;
Index: trunk/extensions/DynamicPageList/DPLMain.php
@@ -2947,7 +2947,7 @@
29482948 $lastNamespaceFound = '';
29492949 $lastTitleFound = '';
29502950
2951 - while ( $row = $dbr->fetchObject ( $res ) ) {
 2951+ foreach ( $res as $row ) {
29522952 $iArticle++;
29532953
29542954 // in random mode skip articles which were not chosen
@@ -3426,7 +3426,7 @@
34273427 . str_replace( ' ', '_', $cat ) . "'" . " WHERE page_namespace='14'",
34283428 __METHOD__
34293429 );
3430 - while ( $row = $dbr->fetchObject ( $res ) ) {
 3430+ foreach ( $res as $row ) {
34313431 if ( $depth > 1 ) {
34323432 $cats .= '|' . self::getSubcategories( $row->page_title, $sPageTable, $depth - 1 );
34333433 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r81930Result objects are objects, not arrays. (fixing breakage from Reedy's mass ch...demon06:16, 11 February 2011

Comments

#Comment by Trevor Parscal (WMF) (talk | contribs)   20:53, 12 November 2010

The changes this rev introduces for FundraiserStatistics_body.php has been reverted. Lots of errors and mistakes were made.

#Comment by RobLa-WMF (talk | contribs)   06:19, 11 February 2011

Reedy, looks like we've had a couple of bugs caused by this already. Could you reevaluate the full list of changes?

#Comment by Reedy (talk | contribs)   11:06, 11 February 2011

Looks alright. Not saying it's perfect, but the only one that was using things weird is Comunity voice...

#Comment by 😂 (talk | contribs)   11:13, 11 February 2011

Can we all agree that batch changes of things like this are really really annoying and should be avoided from now on?

#Comment by Reedy (talk | contribs)   11:15, 11 February 2011

Mmmm. Need to find some saner way of doing it...

#Comment by 😂 (talk | contribs)   11:16, 11 February 2011

How about one extension at a time? Or just while you're refactoring an extension, do it then.

Seemingly non-functional changes for code correctness commonly introduces functional changes as this has shown.

Status & tagging log