Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -971,7 +971,7 @@ |
972 | 972 | # Do a link batch query |
973 | 973 | if( $this->getNumRows() > 0 ) { |
974 | 974 | $lb = new LinkBatch; |
975 | | - while( $row = $this->mResult->fetchObject() ) { |
| 975 | + foreach ( $this->mResult as $row ) { |
976 | 976 | $lb->add( $row->log_namespace, $row->log_title ); |
977 | 977 | $lb->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); |
978 | 978 | $lb->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) ); |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | if( $wgRequest->getVal( 'printable' ) === 'yes' ) { |
110 | 110 | $wgOut->setPrintable(); |
111 | 111 | } |
112 | | - $ret = null; |
| 112 | + |
113 | 113 | if( $curid = $wgRequest->getInt( 'curid' ) ) { |
114 | 114 | // URLs like this are generated by RC, because rc_title isn't always accurate |
115 | 115 | $ret = Title::newFromID( $curid ); |
Index: trunk/phase3/includes/installer/PostgresUpdater.php |
— | — | @@ -280,7 +280,7 @@ |
281 | 281 | } |
282 | 282 | |
283 | 283 | $cols = array(); |
284 | | - while ( $r = $this->db->fetchRow( $res ) ) { |
| 284 | + foreach ( $res as $r ) { |
285 | 285 | $cols[] = array( |
286 | 286 | "name" => $r[0], |
287 | 287 | "ord" => $r[1], |
Index: trunk/phase3/includes/Export.php |
— | — | @@ -300,7 +300,7 @@ |
301 | 301 | */ |
302 | 302 | protected function outputPageStream( $resultset ) { |
303 | 303 | $last = null; |
304 | | - while( $row = $resultset->fetchObject() ) { |
| 304 | + foreach ( $resultset as $row ) { |
305 | 305 | if( is_null( $last ) || |
306 | 306 | $last->page_namespace != $row->page_namespace || |
307 | 307 | $last->page_title != $row->page_title ) { |
— | — | @@ -331,7 +331,7 @@ |
332 | 332 | } |
333 | 333 | |
334 | 334 | protected function outputLogStream( $resultset ) { |
335 | | - while( $row = $resultset->fetchObject() ) { |
| 335 | + foreach ( $resultset as $row ) { |
336 | 336 | $output = $this->writer->writeLogItem( $row ); |
337 | 337 | $this->sink->writeLogItem( $row, $output ); |
338 | 338 | } |
Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -312,12 +312,13 @@ |
313 | 313 | continue; |
314 | 314 | $matches = $ymatches[$line]; |
315 | 315 | reset($matches); |
316 | | - while (list ($junk, $y) = each($matches)) |
317 | | - if (empty($this->in_seq[$y])) { |
318 | | - $k = $this->_lcs_pos($y); |
319 | | - assert($k > 0); |
320 | | - $ymids[$k] = $ymids[$k-1]; |
321 | | - break; |
| 316 | + while ( list( $junk, $y ) = each( $matches ) ) { |
| 317 | + if ( empty( $this->in_seq[$y] ) ) { |
| 318 | + $k = $this->_lcs_pos( $y ); |
| 319 | + assert( $k > 0 ); |
| 320 | + $ymids[$k] = $ymids[$k-1]; |
| 321 | + break; |
| 322 | + } |
322 | 323 | } |
323 | 324 | while (list ( /* $junk */, $y) = each($matches)) { |
324 | 325 | if ($y > $this->seq[$k-1]) { |
Index: trunk/phase3/includes/SquidUpdate.php |
— | — | @@ -40,8 +40,7 @@ |
41 | 41 | __METHOD__ ); |
42 | 42 | $blurlArr = $title->getSquidURLs(); |
43 | 43 | if ( $dbr->numRows( $res ) <= $wgMaxSquidPurgeTitles ) { |
44 | | - while ( $BL = $dbr->fetchObject ( $res ) ) |
45 | | - { |
| 44 | + foreach ( $res as $BL ) { |
46 | 45 | $tobj = Title::makeTitle( $BL->page_namespace, $BL->page_title ) ; |
47 | 46 | $blurlArr[] = $tobj->getInternalURL(); |
48 | 47 | } |
Index: trunk/phase3/includes/WatchlistEditor.php |
— | — | @@ -186,7 +186,7 @@ |
187 | 187 | __METHOD__ |
188 | 188 | ); |
189 | 189 | if( $res->numRows() > 0 ) { |
190 | | - while( $row = $res->fetchObject() ) { |
| 190 | + foreach ( $res as $row ) { |
191 | 191 | $title = Title::makeTitleSafe( $row->wl_namespace, $row->wl_title ); |
192 | 192 | if( $title instanceof Title && !$title->isTalkPage() ) |
193 | 193 | $list[] = $title->getPrefixedText(); |
— | — | @@ -218,7 +218,7 @@ |
219 | 219 | $res = $dbr->query( $sql, __METHOD__ ); |
220 | 220 | if( $res && $dbr->numRows( $res ) > 0 ) { |
221 | 221 | $cache = LinkCache::singleton(); |
222 | | - while( $row = $dbr->fetchObject( $res ) ) { |
| 222 | + foreach ( $res as $row ) { |
223 | 223 | $title = Title::makeTitleSafe( $row->wl_namespace, $row->wl_title ); |
224 | 224 | if( $title instanceof Title ) { |
225 | 225 | // Update the link cache while we're at it |
Index: trunk/phase3/includes/specials/SpecialWatchlist.php |
— | — | @@ -341,7 +341,7 @@ |
342 | 342 | |
343 | 343 | /* Do link batch query */ |
344 | 344 | $linkBatch = new LinkBatch; |
345 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 345 | + foreach ( $res as $row ) { |
346 | 346 | $userNameUnderscored = str_replace( ' ', '_', $row->rc_user_text ); |
347 | 347 | if ( $row->rc_user != 0 ) { |
348 | 348 | $linkBatch->add( NS_USER, $userNameUnderscored ); |
— | — | @@ -358,7 +358,7 @@ |
359 | 359 | |
360 | 360 | $s = $list->beginRecentChangesList(); |
361 | 361 | $counter = 1; |
362 | | - while ( $obj = $dbr->fetchObject( $res ) ) { |
| 362 | + foreach ( $res as $obj ) { |
363 | 363 | # Make RC entry |
364 | 364 | $rc = RecentChange::newFromRow( $obj ); |
365 | 365 | $rc->counter = $counter++; |
Index: trunk/phase3/includes/specials/SpecialUndelete.php |
— | — | @@ -739,7 +739,7 @@ |
740 | 740 | $sk = $wgUser->getSkin(); |
741 | 741 | $undelete = $this->getTitle(); |
742 | 742 | $wgOut->addHTML( "<ul>\n" ); |
743 | | - while( $row = $result->fetchObject() ) { |
| 743 | + foreach ( $result as $row ) { |
744 | 744 | $title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title ); |
745 | 745 | $link = $sk->linkKnown( |
746 | 746 | $undelete, |
— | — | @@ -1059,7 +1059,7 @@ |
1060 | 1060 | # Batch existence check on user and talk pages |
1061 | 1061 | if( $haveRevisions ) { |
1062 | 1062 | $batch = new LinkBatch(); |
1063 | | - while( $row = $revisions->fetchObject() ) { |
| 1063 | + foreach ( $revisions as $row ) { |
1064 | 1064 | $batch->addObj( Title::makeTitleSafe( NS_USER, $row->ar_user_text ) ); |
1065 | 1065 | $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->ar_user_text ) ); |
1066 | 1066 | } |
— | — | @@ -1068,7 +1068,7 @@ |
1069 | 1069 | } |
1070 | 1070 | if( $haveFiles ) { |
1071 | 1071 | $batch = new LinkBatch(); |
1072 | | - while( $row = $files->fetchObject() ) { |
| 1072 | + foreach ( $files as $row ) { |
1073 | 1073 | $batch->addObj( Title::makeTitleSafe( NS_USER, $row->fa_user_text ) ); |
1074 | 1074 | $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->fa_user_text ) ); |
1075 | 1075 | } |
— | — | @@ -1146,7 +1146,7 @@ |
1147 | 1147 | $remaining = $revisions->numRows(); |
1148 | 1148 | $earliestLiveTime = $this->mTargetObj->getEarliestRevTime(); |
1149 | 1149 | |
1150 | | - while( $row = $revisions->fetchObject() ) { |
| 1150 | + foreach ( $revisions as $row ) { |
1151 | 1151 | $remaining--; |
1152 | 1152 | $wgOut->addHTML( $this->formatRevisionRow( $row, $earliestLiveTime, $remaining, $sk ) ); |
1153 | 1153 | } |
— | — | @@ -1159,7 +1159,7 @@ |
1160 | 1160 | if( $haveFiles ) { |
1161 | 1161 | $wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'filehist' ) ) . "\n" ); |
1162 | 1162 | $wgOut->addHTML( "<ul>" ); |
1163 | | - while( $row = $files->fetchObject() ) { |
| 1163 | + foreach ( $files as $row ) { |
1164 | 1164 | $wgOut->addHTML( $this->formatFileRow( $row, $sk ) ); |
1165 | 1165 | } |
1166 | 1166 | $files->free(); |
Index: trunk/phase3/includes/specials/SpecialNewpages.php |
— | — | @@ -511,7 +511,7 @@ |
512 | 512 | function getStartBody() { |
513 | 513 | # Do a batch existence check on pages |
514 | 514 | $linkBatch = new LinkBatch(); |
515 | | - while( $row = $this->mResult->fetchObject() ) { |
| 515 | + foreach ( $this->mResult as $row ) { |
516 | 516 | $linkBatch->add( NS_USER, $row->rc_user_text ); |
517 | 517 | $linkBatch->add( NS_USER_TALK, $row->rc_user_text ); |
518 | 518 | $linkBatch->add( $row->rc_namespace, $row->rc_title ); |
Index: trunk/phase3/includes/specials/SpecialProtectedtitles.php |
— | — | @@ -196,7 +196,7 @@ |
197 | 197 | $this->mResult->seek( 0 ); |
198 | 198 | $lb = new LinkBatch; |
199 | 199 | |
200 | | - while ( $row = $this->mResult->fetchObject() ) { |
| 200 | + foreach ( $this->mResult as $row ) { |
201 | 201 | $lb->add( $row->pt_namespace, $row->pt_title ); |
202 | 202 | } |
203 | 203 | |
Index: trunk/phase3/includes/specials/SpecialNewimages.php |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | * We have to flip things around to get the last N after a certain date |
119 | 119 | */ |
120 | 120 | $images = array(); |
121 | | - while ( $s = $dbr->fetchObject( $res ) ) { |
| 121 | + foreach ( $res as $s ) { |
122 | 122 | if( $invertSort ) { |
123 | 123 | array_unshift( $images, $s ); |
124 | 124 | } else { |
Index: trunk/phase3/includes/specials/SpecialMostlinkedtemplates.php |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | */ |
94 | 94 | public function preprocessResults( $db, $res ) { |
95 | 95 | $batch = new LinkBatch(); |
96 | | - while( $row = $db->fetchObject( $res ) ) { |
| 96 | + foreach ( $res as $row ) { |
97 | 97 | $batch->add( $row->namespace, $row->title ); |
98 | 98 | } |
99 | 99 | $batch->execute(); |
Index: trunk/phase3/includes/specials/SpecialMostlinked.php |
— | — | @@ -73,8 +73,9 @@ |
74 | 74 | function preprocessResults( $db, $res ) { |
75 | 75 | if( $db->numRows( $res ) > 0 ) { |
76 | 76 | $linkBatch = new LinkBatch(); |
77 | | - while( $row = $db->fetchObject( $res ) ) |
| 77 | + foreach ( $res as $row ) { |
78 | 78 | $linkBatch->add( $row->namespace, $row->title ); |
| 79 | + } |
79 | 80 | $db->dataSeek( $res, 0 ); |
80 | 81 | $linkBatch->execute(); |
81 | 82 | } |
Index: trunk/phase3/includes/specials/SpecialProtectedpages.php |
— | — | @@ -309,7 +309,7 @@ |
310 | 310 | function getStartBody() { |
311 | 311 | # Do a link batch query |
312 | 312 | $lb = new LinkBatch; |
313 | | - while( $row = $this->mResult->fetchObject() ) { |
| 313 | + foreach ( $this->mResult as $row ) { |
314 | 314 | $lb->add( $row->page_namespace, $row->page_title ); |
315 | 315 | } |
316 | 316 | $lb->execute(); |
Index: trunk/phase3/includes/specials/SpecialListfiles.php |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | if ( $this->mResult->numRows() ) { |
141 | 141 | $lb = new LinkBatch; |
142 | 142 | $this->mResult->seek( 0 ); |
143 | | - while ( $row = $this->mResult->fetchObject() ) { |
| 143 | + foreach ( $this->mResult as $row ) { |
144 | 144 | if ( $row->img_user ) { |
145 | 145 | $lb->add( NS_USER, str_replace( ' ', '_', $row->img_user_text ) ); |
146 | 146 | } |
Index: trunk/phase3/includes/specials/SpecialWhatlinkshere.php |
— | — | @@ -187,21 +187,21 @@ |
188 | 188 | // templatelinks comes second so that the templatelinks row overwrites the |
189 | 189 | // pagelinks row, so we get (inclusion) rather than nothing |
190 | 190 | if( $fetchlinks ) { |
191 | | - while ( $row = $dbr->fetchObject( $plRes ) ) { |
| 191 | + foreach ( $plRes as $row ) { |
192 | 192 | $row->is_template = 0; |
193 | 193 | $row->is_image = 0; |
194 | 194 | $rows[$row->page_id] = $row; |
195 | 195 | } |
196 | 196 | } |
197 | 197 | if( !$hidetrans ) { |
198 | | - while ( $row = $dbr->fetchObject( $tlRes ) ) { |
| 198 | + foreach ( $tlRes as $row ) { |
199 | 199 | $row->is_template = 1; |
200 | 200 | $row->is_image = 0; |
201 | 201 | $rows[$row->page_id] = $row; |
202 | 202 | } |
203 | 203 | } |
204 | 204 | if( !$hideimages ) { |
205 | | - while ( $row = $dbr->fetchObject( $ilRes ) ) { |
| 205 | + foreach ( $ilRes as $row ) { |
206 | 206 | $row->is_template = 0; |
207 | 207 | $row->is_image = 1; |
208 | 208 | $rows[$row->page_id] = $row; |
Index: trunk/phase3/includes/specials/SpecialExport.php |
— | — | @@ -315,7 +315,7 @@ |
316 | 316 | |
317 | 317 | $pages = array(); |
318 | 318 | |
319 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 319 | + foreach ( $res as $row ) { |
320 | 320 | $n = $row->page_title; |
321 | 321 | if ($row->page_namespace) { |
322 | 322 | $ns = $wgContLang->getNsText( $row->page_namespace ); |
— | — | @@ -341,7 +341,7 @@ |
342 | 342 | |
343 | 343 | $pages = array(); |
344 | 344 | |
345 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 345 | + foreach ( $res as $row ) { |
346 | 346 | $n = $row->page_title; |
347 | 347 | |
348 | 348 | if ( $row->page_namespace ) { |
Index: trunk/phase3/includes/specials/SpecialCategories.php |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | |
106 | 106 | $this->mResult->rewind(); |
107 | 107 | |
108 | | - while ( $row = $this->mResult->fetchObject() ) { |
| 108 | + foreach ( $this->mResult as $row ) { |
109 | 109 | $batch->addObj( Title::makeTitleSafe( NS_CATEGORY, $row->cat_title ) ); |
110 | 110 | } |
111 | 111 | $batch->execute(); |
Index: trunk/phase3/includes/specials/SpecialStatistics.php |
— | — | @@ -278,7 +278,7 @@ |
279 | 279 | $text .= Xml::openElement( 'tr' ); |
280 | 280 | $text .= Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-mostpopular', array( 'parseinline' ) ) ); |
281 | 281 | $text .= Xml::closeElement( 'tr' ); |
282 | | - while( $row = $res->fetchObject() ) { |
| 282 | + foreach ( $res as $row ) { |
283 | 283 | $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); |
284 | 284 | if( $title instanceof Title ) { |
285 | 285 | $text .= $this->formatRow( $sk->link( $title ), |
Index: trunk/phase3/includes/specials/SpecialTags.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | $dbr = wfGetDB( DB_SLAVE ); |
52 | 52 | $res = $dbr->select( 'change_tag', array( 'ct_tag', 'count(*) as hitcount' ), array(), __METHOD__, array( 'GROUP BY' => 'ct_tag', 'ORDER BY' => 'hitcount DESC' ) ); |
53 | 53 | |
54 | | - while ( $row = $res->fetchObject() ) { |
| 54 | + foreach ( $res as $row ) { |
55 | 55 | $html .= $this->doTagRow( $row->ct_tag, $row->hitcount ); |
56 | 56 | } |
57 | 57 | |
Index: trunk/phase3/includes/specials/SpecialAllmessages.php |
— | — | @@ -227,7 +227,7 @@ |
228 | 228 | |
229 | 229 | $pageFlags = $talkFlags = array(); |
230 | 230 | |
231 | | - while( $s = $dbr->fetchObject( $res ) ) { |
| 231 | + foreach ( $res as $s ) { |
232 | 232 | if( $s->page_namespace == NS_MEDIAWIKI ) { |
233 | 233 | if( $this->foreign ) { |
234 | 234 | $title = explode( '/', $s->page_title ); |
Index: trunk/phase3/includes/specials/SpecialIpblocklist.php |
— | — | @@ -544,7 +544,7 @@ |
545 | 545 | # Faster way |
546 | 546 | # Usernames and titles are in fact related by a simple substitution of space -> underscore |
547 | 547 | # The last few lines of Title::secureAndSplit() tell the story. |
548 | | - while ( $row = $this->mResult->fetchObject() ) { |
| 548 | + foreach ( $this->mResult as $row ) { |
549 | 549 | $name = str_replace( ' ', '_', $row->ipb_by_text ); |
550 | 550 | $lb->add( NS_USER, $name ); |
551 | 551 | $lb->add( NS_USER_TALK, $name ); |
Index: trunk/phase3/includes/specials/SpecialMostlinkedcategories.php |
— | — | @@ -58,8 +58,9 @@ |
59 | 59 | */ |
60 | 60 | function preprocessResults( $db, $res ) { |
61 | 61 | $batch = new LinkBatch; |
62 | | - while ( $row = $db->fetchObject( $res ) ) |
| 62 | + foreach ( $res as $row ) { |
63 | 63 | $batch->add( $row->namespace, $row->title ); |
| 64 | + } |
64 | 65 | $batch->execute(); |
65 | 66 | |
66 | 67 | // Back to start for display |
Index: trunk/phase3/includes/specials/SpecialMergeHistory.php |
— | — | @@ -438,7 +438,7 @@ |
439 | 439 | $batch = new LinkBatch(); |
440 | 440 | # Give some pointers to make (last) links |
441 | 441 | $this->mForm->prevId = array(); |
442 | | - while( $row = $this->mResult->fetchObject() ) { |
| 442 | + foreach ( $this->mResult as $row ) { |
443 | 443 | $batch->addObj( Title::makeTitleSafe( NS_USER, $row->rev_user_text ) ); |
444 | 444 | $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->rev_user_text ) ); |
445 | 445 | |
Index: trunk/phase3/includes/specials/SpecialDisambiguations.php |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | 'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()), |
71 | 71 | __METHOD__ ); |
72 | 72 | |
73 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 73 | + foreach ( $res as $row ) { |
74 | 74 | $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title )); |
75 | 75 | } |
76 | 76 | } |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -2106,9 +2106,8 @@ |
2107 | 2107 | */ |
2108 | 2108 | private function loadRestrictionsFromResultWrapper( $res, $oldFashionedRestrictions = null ) { |
2109 | 2109 | $rows = array(); |
2110 | | - $dbr = wfGetDB( DB_SLAVE ); |
2111 | 2110 | |
2112 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 2111 | + foreach ( $res as $row ) { |
2113 | 2112 | $rows[] = $row; |
2114 | 2113 | } |
2115 | 2114 | |
Index: trunk/phase3/includes/LinkBatch.php |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | |
111 | 111 | $ids = array(); |
112 | 112 | $remaining = $this->data; |
113 | | - while ( $row = $res->fetchObject() ) { |
| 113 | + foreach ( $res as $row ) { |
114 | 114 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
115 | 115 | $cache->addGoodLinkObj( $row->page_id, $title, $row->page_len, $row->page_is_redirect, $row->page_latest ); |
116 | 116 | $ids[$title->getPrefixedDBkey()] = $row->page_id; |
Index: trunk/phase3/includes/CacheDependency.php |
— | — | @@ -280,7 +280,7 @@ |
281 | 281 | __METHOD__ |
282 | 282 | ); |
283 | 283 | |
284 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 284 | + foreach ( $res as $row ) { |
285 | 285 | $timestamps[$row->page_namespace][$row->page_title] = $row->page_touched; |
286 | 286 | } |
287 | 287 | } |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -1079,7 +1079,7 @@ |
1080 | 1080 | ), |
1081 | 1081 | __METHOD__, |
1082 | 1082 | array( 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 50 ) ); |
1083 | | - while( $row = $res->fetchObject() ) { |
| 1083 | + foreach ( $res as $row ) { |
1084 | 1084 | if( $row->rev_user != $id ) { |
1085 | 1085 | return false; |
1086 | 1086 | } |
Index: trunk/phase3/includes/api/ApiDelete.php |
— | — | @@ -232,7 +232,7 @@ |
233 | 233 | ApiBase::PARAM_DFLT => false, |
234 | 234 | ApiBase::PARAM_DEPRECATED => true, |
235 | 235 | ), |
236 | | - 'oldimage' => null |
| 236 | + 'oldimage' => null, |
237 | 237 | ); |
238 | 238 | } |
239 | 239 | |
Index: trunk/phase3/includes/Block.php |
— | — | @@ -531,7 +531,7 @@ |
532 | 532 | # No results, don't autoblock anything |
533 | 533 | wfDebug( "No IP found to retroactively autoblock\n" ); |
534 | 534 | } else { |
535 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 535 | + foreach ( $res as $row ) { |
536 | 536 | if ( $row->rc_ip ) { |
537 | 537 | $this->doAutoblock( $row->rc_ip ); |
538 | 538 | } |
Index: trunk/phase3/includes/parser/LinkHolderArray.php |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | |
206 | 206 | # Fetch data and form into an associative array |
207 | 207 | # non-existent = broken |
208 | | - while ( $s = $dbr->fetchObject($res) ) { |
| 208 | + foreach ( $res as $s ) { |
209 | 209 | $title = Title::makeTitle( $s->page_namespace, $s->page_title ); |
210 | 210 | $pdbk = $title->getPrefixedDBkey(); |
211 | 211 | $linkCache->addGoodLinkObj( $s->page_id, $title, $s->page_len, $s->page_is_redirect, $s->page_latest ); |
— | — | @@ -337,9 +337,9 @@ |
338 | 338 | foreach ( $titlesAllVariants as &$titlesVariant ) { |
339 | 339 | $titlesVariant = explode( "\0", $titlesVariant ); |
340 | 340 | } |
341 | | - |
| 341 | + $l = count( $titlesAttrs ); |
342 | 342 | // Then add variants of links to link batch |
343 | | - for ( $i = 0; $l = count( $titlesAttrs ), $i < $l; $i ++ ) { |
| 343 | + for ( $i = 0; $i < $l; $i ++ ) { |
344 | 344 | foreach ( $allVariantsName as $variantName ) { |
345 | 345 | $textVariant = $titlesAllVariants[$variantName][$i]; |
346 | 346 | extract( $titlesAttrs[$i] ); |
— | — | @@ -381,7 +381,7 @@ |
382 | 382 | $linkcolour_ids = array(); |
383 | 383 | |
384 | 384 | // for each found variants, figure out link holders and replace |
385 | | - while ( $s = $dbr->fetchObject($varRes) ) { |
| 385 | + foreach ( $varRes as $s ) { |
386 | 386 | |
387 | 387 | $variantTitle = Title::makeTitle( $s->page_namespace, $s->page_title ); |
388 | 388 | $varPdbk = $variantTitle->getPrefixedDBkey(); |
Index: trunk/phase3/includes/WatchedItem.php |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | ); |
145 | 145 | # Construct array to replace into the watchlist |
146 | 146 | $values = array(); |
147 | | - while ( $s = $dbw->fetchObject( $res ) ) { |
| 147 | + foreach ( $res as $s ) { |
148 | 148 | $values[] = array( |
149 | 149 | 'wl_user' => $s->wl_user, |
150 | 150 | 'wl_namespace' => $newnamespace, |
Index: trunk/phase3/includes/ChangeTags.php |
— | — | @@ -181,15 +181,16 @@ |
182 | 182 | global $wgMemc; |
183 | 183 | $key = wfMemcKey( 'valid-tags' ); |
184 | 184 | |
185 | | - if ( $tags = $wgMemc->get( $key ) ) |
| 185 | + if ( $tags = $wgMemc->get( $key ) ) { |
186 | 186 | return $tags; |
| 187 | + } |
187 | 188 | |
188 | 189 | $emptyTags = array(); |
189 | 190 | |
190 | 191 | // Some DB stuff |
191 | 192 | $dbr = wfGetDB( DB_SLAVE ); |
192 | 193 | $res = $dbr->select( 'valid_tag', 'vt_tag', array(), __METHOD__ ); |
193 | | - while( $row = $res->fetchObject() ) { |
| 194 | + foreach ( $res as $row ) { |
194 | 195 | $emptyTags[] = $row->vt_tag; |
195 | 196 | } |
196 | 197 | |
Index: trunk/phase3/includes/UserMailer.php |
— | — | @@ -306,7 +306,7 @@ |
307 | 307 | 'wl_notificationtimestamp IS NULL', |
308 | 308 | ), __METHOD__ |
309 | 309 | ); |
310 | | - while ($row = $dbw->fetchObject( $res ) ) { |
| 310 | + foreach ( $res as $row ) { |
311 | 311 | $watchers[] = intval( $row->wl_user ); |
312 | 312 | } |
313 | 313 | if ($watchers) { |
Index: trunk/phase3/includes/User.php |
— | — | @@ -976,7 +976,7 @@ |
977 | 977 | array( 'ug_user' => $this->mId ), |
978 | 978 | __METHOD__ ); |
979 | 979 | $this->mGroups = array(); |
980 | | - while( $row = $dbr->fetchObject( $res ) ) { |
| 980 | + foreach ( $res as $row ) { |
981 | 981 | $this->mGroups[] = $row->ug_group; |
982 | 982 | } |
983 | 983 | } |
— | — | @@ -3633,7 +3633,7 @@ |
3634 | 3634 | __METHOD__ |
3635 | 3635 | ); |
3636 | 3636 | |
3637 | | - while( $row = $dbr->fetchObject( $res ) ) { |
| 3637 | + foreach ( $res as $row ) { |
3638 | 3638 | $this->mOptionOverrides[$row->up_property] = $row->up_value; |
3639 | 3639 | $this->mOptions[$row->up_property] = $row->up_value; |
3640 | 3640 | } |
Index: trunk/phase3/includes/UserRightsProxy.php |
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | array( 'ug_user' => $this->id ), |
159 | 159 | __METHOD__ ); |
160 | 160 | $groups = array(); |
161 | | - while( $row = $this->db->fetchObject( $res ) ) { |
| 161 | + foreach ( $res as $row ) { |
162 | 162 | $groups[] = $row->ug_group; |
163 | 163 | } |
164 | 164 | return $groups; |
Index: trunk/phase3/includes/Categoryfinder.php |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | /* WHERE */ array( 'cl_from' => $this->next ), |
156 | 156 | __METHOD__ . '-1' |
157 | 157 | ); |
158 | | - while ( $o = $this->dbr->fetchObject( $res ) ) { |
| 158 | + foreach ( $res as $o ) { |
159 | 159 | $k = $o->cl_to; |
160 | 160 | |
161 | 161 | # Update parent tree |
— | — | @@ -186,7 +186,7 @@ |
187 | 187 | /* WHERE */ array( 'page_namespace' => NS_CATEGORY , 'page_title' => $layer ), |
188 | 188 | __METHOD__ . '-2' |
189 | 189 | ); |
190 | | - while ( $o = $this->dbr->fetchObject( $res ) ) { |
| 190 | + foreach ( $res as $o ) { |
191 | 191 | $id = $o->page_id; |
192 | 192 | $name = $o->page_title; |
193 | 193 | $this->name2id[$name] = $id; |
Index: trunk/phase3/includes/filerepo/File.php |
— | — | @@ -892,7 +892,7 @@ |
893 | 893 | |
894 | 894 | $retVal = array(); |
895 | 895 | if ( $db->numRows( $res ) ) { |
896 | | - while ( $row = $db->fetchObject( $res ) ) { |
| 896 | + foreach ( $res as $row ) { |
897 | 897 | if ( $titleObj = Title::newFromRow( $row ) ) { |
898 | 898 | $linkCache->addGoodLinkObj( $row->page_id, $titleObj, $row->page_len, $row->page_is_redirect, $row->page_latest ); |
899 | 899 | $retVal[] = $titleObj; |
Index: trunk/phase3/includes/filerepo/LocalRepo.php |
— | — | @@ -164,9 +164,10 @@ |
165 | 165 | ); |
166 | 166 | |
167 | 167 | $result = array(); |
168 | | - while ( $row = $res->fetchObject() ) |
| 168 | + foreach ( $res as $row ) { |
169 | 169 | $result[] = $this->newFileFromRow( $row ); |
170 | | - $res->free(); |
| 170 | + } |
| 171 | + |
171 | 172 | return $result; |
172 | 173 | } |
173 | 174 | |
Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -713,7 +713,7 @@ |
714 | 714 | $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $opts, $join_conds ); |
715 | 715 | $r = array(); |
716 | 716 | |
717 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 717 | + foreach ( $res as $row ) { |
718 | 718 | if ( $this->repo->oldFileFromRowFactory ) { |
719 | 719 | $r[] = call_user_func( $this->repo->oldFileFromRowFactory, $row, $this->repo ); |
720 | 720 | } else { |
— | — | @@ -1127,7 +1127,7 @@ |
1128 | 1128 | $result = $dbw->select( 'oldimage', |
1129 | 1129 | array( 'oi_archive_name' ), |
1130 | 1130 | array( 'oi_name' => $this->getName() ) ); |
1131 | | - while ( $row = $dbw->fetchObject( $result ) ) { |
| 1131 | + foreach ( $result as $row ) { |
1132 | 1132 | $batch->addOld( $row->oi_archive_name ); |
1133 | 1133 | } |
1134 | 1134 | $status = $batch->execute(); |
— | — | @@ -1341,7 +1341,7 @@ |
1342 | 1342 | __METHOD__ |
1343 | 1343 | ); |
1344 | 1344 | |
1345 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 1345 | + foreach ( $res as $row ) { |
1346 | 1346 | if ( rtrim( $row->oi_sha1, "\0" ) === '' ) { |
1347 | 1347 | // Get the hash from the file |
1348 | 1348 | $oldUrl = $this->file->getArchiveVirtualUrl( $row->oi_archive_name ); |
— | — | @@ -1504,7 +1504,7 @@ |
1505 | 1505 | $dbw->bitAnd( 'oi_deleted', File::DELETED_FILE ) => File::DELETED_FILE ), |
1506 | 1506 | __METHOD__ ); |
1507 | 1507 | |
1508 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 1508 | + foreach ( $res as $row ) { |
1509 | 1509 | $privateFiles[$row->oi_archive_name] = 1; |
1510 | 1510 | } |
1511 | 1511 | } |
— | — | @@ -1674,7 +1674,7 @@ |
1675 | 1675 | $first = true; |
1676 | 1676 | $archiveNames = array(); |
1677 | 1677 | |
1678 | | - while ( $row = $dbw->fetchObject( $result ) ) { |
| 1678 | + foreach ( $result as $row ) { |
1679 | 1679 | $idsPresent[] = $row->fa_id; |
1680 | 1680 | |
1681 | 1681 | if ( $row->fa_name != $this->file->getName() ) { |
— | — | @@ -1958,7 +1958,7 @@ |
1959 | 1959 | __METHOD__ |
1960 | 1960 | ); |
1961 | 1961 | |
1962 | | - while ( $row = $this->db->fetchObject( $result ) ) { |
| 1962 | + foreach ( $result as $row ) { |
1963 | 1963 | $oldName = $row->oi_archive_name; |
1964 | 1964 | $bits = explode( '!', $oldName, 2 ); |
1965 | 1965 | |
Index: trunk/phase3/includes/LinksUpdate.php |
— | — | @@ -247,7 +247,7 @@ |
248 | 248 | 'page_touched < ' . $this->mDb->addQuotes( $now ) |
249 | 249 | ), __METHOD__ |
250 | 250 | ); |
251 | | - while ( $row = $this->mDb->fetchObject( $res ) ) { |
| 251 | + foreach ( $res as $row ) { |
252 | 252 | $ids[] = $row->page_id; |
253 | 253 | } |
254 | 254 | if ( !count( $ids ) ) { |
— | — | @@ -628,7 +628,7 @@ |
629 | 629 | $res = $this->mDb->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ), |
630 | 630 | array( 'pl_from' => $this->mId ), __METHOD__, $this->mOptions ); |
631 | 631 | $arr = array(); |
632 | | - while ( $row = $this->mDb->fetchObject( $res ) ) { |
| 632 | + foreach ( $res as $row ) { |
633 | 633 | if ( !isset( $arr[$row->pl_namespace] ) ) { |
634 | 634 | $arr[$row->pl_namespace] = array(); |
635 | 635 | } |
— | — | @@ -645,7 +645,7 @@ |
646 | 646 | $res = $this->mDb->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ), |
647 | 647 | array( 'tl_from' => $this->mId ), __METHOD__, $this->mOptions ); |
648 | 648 | $arr = array(); |
649 | | - while ( $row = $this->mDb->fetchObject( $res ) ) { |
| 649 | + foreach ( $res as $row ) { |
650 | 650 | if ( !isset( $arr[$row->tl_namespace] ) ) { |
651 | 651 | $arr[$row->tl_namespace] = array(); |
652 | 652 | } |
— | — | @@ -662,7 +662,7 @@ |
663 | 663 | $res = $this->mDb->select( 'imagelinks', array( 'il_to' ), |
664 | 664 | array( 'il_from' => $this->mId ), __METHOD__, $this->mOptions ); |
665 | 665 | $arr = array(); |
666 | | - while ( $row = $this->mDb->fetchObject( $res ) ) { |
| 666 | + foreach ( $res as $row ) { |
667 | 667 | $arr[$row->il_to] = 1; |
668 | 668 | } |
669 | 669 | return $arr; |
— | — | @@ -676,7 +676,7 @@ |
677 | 677 | $res = $this->mDb->select( 'externallinks', array( 'el_to' ), |
678 | 678 | array( 'el_from' => $this->mId ), __METHOD__, $this->mOptions ); |
679 | 679 | $arr = array(); |
680 | | - while ( $row = $this->mDb->fetchObject( $res ) ) { |
| 680 | + foreach ( $res as $row ) { |
681 | 681 | $arr[$row->el_to] = 1; |
682 | 682 | } |
683 | 683 | return $arr; |
— | — | @@ -690,7 +690,7 @@ |
691 | 691 | $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey' ), |
692 | 692 | array( 'cl_from' => $this->mId ), __METHOD__, $this->mOptions ); |
693 | 693 | $arr = array(); |
694 | | - while ( $row = $this->mDb->fetchObject( $res ) ) { |
| 694 | + foreach ( $res as $row ) { |
695 | 695 | $arr[$row->cl_to] = $row->cl_sortkey; |
696 | 696 | } |
697 | 697 | return $arr; |
— | — | @@ -705,7 +705,7 @@ |
706 | 706 | $res = $this->mDb->select( 'langlinks', array( 'll_lang', 'll_title' ), |
707 | 707 | array( 'll_from' => $this->mId ), __METHOD__, $this->mOptions ); |
708 | 708 | $arr = array(); |
709 | | - while ( $row = $this->mDb->fetchObject( $res ) ) { |
| 709 | + foreach ( $res as $row ) { |
710 | 710 | $arr[$row->ll_lang] = $row->ll_title; |
711 | 711 | } |
712 | 712 | return $arr; |
— | — | @@ -719,7 +719,7 @@ |
720 | 720 | $res = $this->mDb->select( 'iwlinks', array( 'iwl_prefix', 'iwl_title' ), |
721 | 721 | array( 'iwl_from' => $this->mId ), __METHOD__, $this->mOptions ); |
722 | 722 | $arr = array(); |
723 | | - while ( $row = $this->mDb->fetchObject( $res ) ) { |
| 723 | + foreach ( $res as $row ) { |
724 | 724 | if ( !isset( $arr[$row->iwl_prefix] ) ) { |
725 | 725 | $arr[$row->iwl_prefix] = array(); |
726 | 726 | } |
— | — | @@ -736,7 +736,7 @@ |
737 | 737 | $res = $this->mDb->select( 'page_props', array( 'pp_propname', 'pp_value' ), |
738 | 738 | array( 'pp_page' => $this->mId ), __METHOD__, $this->mOptions ); |
739 | 739 | $arr = array(); |
740 | | - while ( $row = $this->mDb->fetchObject( $res ) ) { |
| 740 | + foreach ( $res as $row ) { |
741 | 741 | $arr[$row->pp_propname] = $row->pp_value; |
742 | 742 | } |
743 | 743 | return $arr; |
Index: trunk/phase3/includes/QueryPage.php |
— | — | @@ -482,9 +482,11 @@ |
483 | 483 | $sql = $this->getSQL() . $this->getOrder(); |
484 | 484 | $sql = $dbr->limitResult( $sql, $limit, 0 ); |
485 | 485 | $res = $dbr->query( $sql, 'QueryPage::doFeed' ); |
486 | | - while( $obj = $dbr->fetchObject( $res ) ) { |
| 486 | + foreach ( $res as $obj ) { |
487 | 487 | $item = $this->feedResult( $obj ); |
488 | | - if( $item ) $feed->outItem( $item ); |
| 488 | + if( $item ) { |
| 489 | + $feed->outItem( $item ); |
| 490 | + } |
489 | 491 | } |
490 | 492 | |
491 | 493 | $feed->outFooter(); |
— | — | @@ -567,8 +569,9 @@ |
568 | 570 | */ |
569 | 571 | function preprocessResults( $db, $res ) { |
570 | 572 | $batch = new LinkBatch; |
571 | | - while ( $row = $db->fetchObject( $res ) ) |
| 573 | + foreach ( $res as $row ) { |
572 | 574 | $batch->add( $row->namespace, $row->title ); |
| 575 | + } |
573 | 576 | $batch->execute(); |
574 | 577 | |
575 | 578 | // Back to start for display |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1590,7 +1590,7 @@ |
1591 | 1591 | } |
1592 | 1592 | |
1593 | 1593 | $tbtext = ""; |
1594 | | - while ( $o = $dbr->fetchObject( $tbs ) ) { |
| 1594 | + foreach ( $tbs as $o ) { |
1595 | 1595 | $rmvtxt = ""; |
1596 | 1596 | |
1597 | 1597 | if ( $wgUser->isAllowed( 'trackback' ) ) { |
— | — | @@ -2992,7 +2992,7 @@ |
2993 | 2993 | |
2994 | 2994 | $authors = array( $row->rev_user_text ); |
2995 | 2995 | |
2996 | | - while ( $row = $db->fetchObject( $res ) ) { |
| 2996 | + foreach ( $res as $row ) { |
2997 | 2997 | $authors[] = $row->rev_user_text; |
2998 | 2998 | } |
2999 | 2999 | |
Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -1217,7 +1217,7 @@ |
1218 | 1218 | |
1219 | 1219 | $result = array(); |
1220 | 1220 | |
1221 | | - while ( $row = $this->fetchObject( $res ) ) { |
| 1221 | + foreach ( $res as $row ) { |
1222 | 1222 | if ( $row->Key_name == $index ) { |
1223 | 1223 | $result[] = $row; |
1224 | 1224 | } |
— | — | @@ -2332,7 +2332,7 @@ |
2333 | 2333 | $res = $this->query( "SHOW STATUS LIKE '{$which}'" ); |
2334 | 2334 | $status = array(); |
2335 | 2335 | |
2336 | | - while ( $row = $this->fetchObject( $res ) ) { |
| 2336 | + foreach ( $res as $row ) { |
2337 | 2337 | $status[$row->Variable_name] = $row->Value; |
2338 | 2338 | } |
2339 | 2339 | |
Index: trunk/phase3/includes/db/DatabaseMssql.php |
— | — | @@ -347,7 +347,7 @@ |
348 | 348 | } |
349 | 349 | |
350 | 350 | $result = array(); |
351 | | - while ( $row = $res->FetchNextObj() ) { |
| 351 | + foreach ( $res as $row ) { |
352 | 352 | if ( $row->index_name == $index ) { |
353 | 353 | $row->Non_unique = !stristr( $row->index_description, "unique" ); |
354 | 354 | $cols = explode( ", ", $row->index_keys ); |
— | — | @@ -784,8 +784,9 @@ |
785 | 785 | print( "Error in fieldInfo query: " . $this->getErrors() ); |
786 | 786 | return false; |
787 | 787 | } |
788 | | - if ( $meta = $this->fetchRow( $res ) ) |
| 788 | + if ( $meta = $this->fetchRow( $res ) ) { |
789 | 789 | return new MssqlField( $meta ); |
| 790 | + } |
790 | 791 | return false; |
791 | 792 | } |
792 | 793 | |
Index: trunk/phase3/includes/db/DatabaseMysql.php |
— | — | @@ -260,7 +260,7 @@ |
261 | 261 | } |
262 | 262 | |
263 | 263 | $rows = 1; |
264 | | - while( $plan = $this->fetchObject( $res ) ) { |
| 264 | + foreach ( $res as $plan ) { |
265 | 265 | $rows *= $plan->rows > 0 ? $plan->rows : 1; // avoid resetting to zero |
266 | 266 | } |
267 | 267 | return $rows; |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -737,7 +737,7 @@ |
738 | 738 | if ( !$res ) { |
739 | 739 | return null; |
740 | 740 | } |
741 | | - while ( $row = $this->fetchObject( $res ) ) { |
| 741 | + foreach ( $res as $row ) { |
742 | 742 | if ( $row->indexname == $this->indexName( $index ) ) { |
743 | 743 | return $row; |
744 | 744 | } |
— | — | @@ -754,7 +754,7 @@ |
755 | 755 | if ( !$res ) { |
756 | 756 | return null; |
757 | 757 | } |
758 | | - while ( $row = $this->fetchObject( $res ) ) { |
| 758 | + foreach ( $res as $row ) { |
759 | 759 | return true; |
760 | 760 | } |
761 | 761 | return false; |