Index: trunk/phase3/maintenance/storage/compressOld.inc |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | break; |
20 | 20 | } |
21 | 21 | $last = $start; |
22 | | - while( $row = $dbw->fetchObject( $res ) ) { |
| 22 | + foreach ( $res as $row ) { |
23 | 23 | # print " {$row->old_id} - {$row->old_namespace}:{$row->old_title}\n"; |
24 | 24 | compressPage( $row, $extdb ); |
25 | 25 | $last = $row->old_id; |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | $revLoadOptions |
171 | 171 | ); |
172 | 172 | $revs = array(); |
173 | | - while ( $revRow = $dbw->fetchObject( $revRes ) ) { |
| 173 | + foreach ( $res as $row ) { |
174 | 174 | $revs[] = $revRow; |
175 | 175 | } |
176 | 176 | |
Index: trunk/phase3/maintenance/storage/moveToExternal.php |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | "old_id BETWEEN $blockStart AND $blockEnd", |
61 | 61 | 'old_flags NOT ' . $dbr->buildLike( $dbr->anyString(), 'external', $dbr->anyString() ), |
62 | 62 | ), $fname ); |
63 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 63 | + foreach ( $res as $row ) { |
64 | 64 | # Resolve stubs |
65 | 65 | $text = $row->old_text; |
66 | 66 | $id = $row->old_id; |
Index: trunk/phase3/maintenance/storage/resolveStubs.php |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | "AND old_flags LIKE '%object%' AND old_flags NOT LIKE '%external%' " . |
40 | 40 | 'AND LOWER(CONVERT(LEFT(old_text,22) USING latin1)) = \'o:15:"historyblobstub"\'', |
41 | 41 | $fname ); |
42 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 42 | + foreach ( $res as $row ) { |
43 | 43 | resolveStub( $row->old_id, $row->old_text, $row->old_flags ); |
44 | 44 | } |
45 | 45 | } |
Index: trunk/phase3/maintenance/storage/checkStorage.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | $dbr->ping(); |
72 | 72 | $res = $dbr->select( 'revision', array( 'rev_id', 'rev_text_id' ), |
73 | 73 | array( "rev_id BETWEEN $chunkStart AND $chunkEnd" ), $fname ); |
74 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 74 | + foreach ( $res as $row ) { |
75 | 75 | $this->oldIdMap[$row->rev_id] = $row->rev_text_id; |
76 | 76 | } |
77 | 77 | $dbr->freeResult( $res ); |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | $objectRevs = array(); |
87 | 87 | $res = $dbr->select( 'text', array( 'old_id', 'old_flags' ), |
88 | 88 | 'old_id IN (' . implode( ',', $this->oldIdMap ) . ')', $fname ); |
89 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 89 | + foreach ( $res as $row ) { |
90 | 90 | $flags = $row->old_flags; |
91 | 91 | $id = $row->old_id; |
92 | 92 | |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | if ( count( $externalRevs ) ) { |
141 | 141 | $res = $dbr->select( 'text', array( 'old_id', 'old_flags', 'old_text' ), |
142 | 142 | array( 'old_id IN (' . implode( ',', $externalRevs ) . ')' ), $fname ); |
143 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 143 | + foreach ( $res as $row ) { |
144 | 144 | $urlParts = explode( '://', $row->old_text, 2 ); |
145 | 145 | if ( count( $urlParts ) !== 2 || $urlParts[1] == '' ) { |
146 | 146 | $this->error( 'restore text', "Error: invalid URL \"{$row->old_text}\"", $row->old_id ); |
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | $res = $extDb->select( $blobsTable, |
179 | 179 | array( 'blob_id' ), |
180 | 180 | array( 'blob_id IN( ' . implode( ',', $blobIds ) . ')' ), $fname ); |
181 | | - while ( $row = $extDb->fetchObject( $res ) ) { |
| 181 | + foreach ( $res as $row ) { |
182 | 182 | unset( $xBlobIds[$row->blob_id] ); |
183 | 183 | } |
184 | 184 | $extDb->freeResult( $res ); |
— | — | @@ -196,7 +196,7 @@ |
197 | 197 | $headerLength = 300; |
198 | 198 | $res = $dbr->select( 'text', array( 'old_id', 'old_flags', "LEFT(old_text, $headerLength) AS header" ), |
199 | 199 | array( 'old_id IN (' . implode( ',', $objectRevs ) . ')' ), $fname ); |
200 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 200 | + foreach ( $res as $row ) { |
201 | 201 | $oldId = $row->old_id; |
202 | 202 | $matches = array(); |
203 | 203 | if ( !preg_match( '/^O:(\d+):"(\w+)"/', $row->header, $matches ) ) { |
— | — | @@ -247,7 +247,7 @@ |
248 | 248 | $headerLength = 300; |
249 | 249 | $res = $dbr->select( 'text', array( 'old_id', 'old_flags', "LEFT(old_text, $headerLength) AS header" ), |
250 | 250 | array( 'old_id IN (' . implode( ',', array_keys( $concatBlobs ) ) . ')' ), $fname ); |
251 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 251 | + foreach ( $res as $row ) { |
252 | 252 | $flags = explode( ',', $row->old_flags ); |
253 | 253 | if ( in_array( 'external', $flags ) ) { |
254 | 254 | // Concat blob is in external storage? |
— | — | @@ -355,7 +355,7 @@ |
356 | 356 | $res = $extDb->select( $blobsTable, |
357 | 357 | array( 'blob_id', "LEFT(blob_text, $headerLength) AS header" ), |
358 | 358 | array( 'blob_id IN( ' . implode( ',', $blobIds ) . ')' ), $fname ); |
359 | | - while ( $row = $extDb->fetchObject( $res ) ) { |
| 359 | + foreach ( $res as $row ) { |
360 | 360 | if ( strcasecmp( $row->header, CONCAT_HEADER ) ) { |
361 | 361 | $this->error( 'restore text', "Error: invalid header on target $cluster/{$row->blob_id} of two-part ES URL", |
362 | 362 | $oldIds[$row->blob_id] ); |
Index: trunk/phase3/maintenance/userOptions.inc |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | __METHOD__ |
113 | 113 | ); |
114 | 114 | |
115 | | - while ( $id = $dbr->fetchObject( $result ) ) { |
| 115 | + foreach ( $result as $id ) { |
116 | 116 | |
117 | 117 | $user = User::newFromId( $id->user_id ); |
118 | 118 | |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | __METHOD__ |
163 | 163 | ); |
164 | 164 | |
165 | | - while ( $id = $dbr->fetchObject( $result ) ) { |
| 165 | + foreach ( $result as $id ) { |
166 | 166 | |
167 | 167 | $user = User::newFromId( $id->user_id ); |
168 | 168 | |
Index: trunk/phase3/maintenance/rollbackEdits.php |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | array( 'page_latest = rev_id', 'rev_user_text' => $user ), |
88 | 88 | __METHOD__ |
89 | 89 | ); |
90 | | - while ( $row = $dbr->fetchObject( $results ) ) { |
| 90 | + foreach ( $results as $row ) { |
91 | 91 | $titles[] = Title::makeTitle( $row->page_namespace, $row->page_title ); |
92 | 92 | } |
93 | 93 | return $titles; |
Index: trunk/phase3/maintenance/purgeOldText.inc |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | # Get "active" text records from the revisions table |
23 | 23 | echo( "Searching for active text records in revisions table..." ); |
24 | 24 | $res = $dbw->query( "SELECT DISTINCT rev_text_id FROM $tbl_rev" ); |
25 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 25 | + foreach ( $res as $row ) { |
26 | 26 | $cur[] = $row->rev_text_id; |
27 | 27 | } |
28 | 28 | echo( "done.\n" ); |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | # Get "active" text records from the archive table |
31 | 31 | echo( "Searching for active text records in archive table..." ); |
32 | 32 | $res = $dbw->query( "SELECT DISTINCT ar_text_id FROM $tbl_arc" ); |
33 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 33 | + foreach ( $res as $row ) { { |
34 | 34 | $cur[] = $row->ar_text_id; |
35 | 35 | } |
36 | 36 | echo( "done.\n" ); |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | $set = implode( ', ', $cur ); |
41 | 41 | $res = $dbw->query( "SELECT old_id FROM $tbl_txt WHERE old_id NOT IN ( $set )" ); |
42 | 42 | $old = array(); |
43 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 43 | + foreach ( $res as $row ) { { |
44 | 44 | $old[] = $row->old_id; |
45 | 45 | } |
46 | 46 | echo( "done.\n" ); |
Index: trunk/phase3/maintenance/userDupes.inc |
— | — | @@ -190,7 +190,7 @@ |
191 | 191 | HAVING n > 1", $fname ); |
192 | 192 | |
193 | 193 | $list = array(); |
194 | | - while ( $row = $this->db->fetchObject( $result ) ) { |
| 194 | + foreach ( $res as $row ) { |
195 | 195 | $list[] = $row->user_name; |
196 | 196 | } |
197 | 197 | return $list; |
— | — | @@ -215,7 +215,7 @@ |
216 | 216 | $firstId = $firstRow->user_id; |
217 | 217 | wfOut( "Record that will be used for '$name' is user_id=$firstId\n" ); |
218 | 218 | |
219 | | - while ( $row = $this->db->fetchObject( $result ) ) { |
| 219 | + foreach ( $result as $row ) { |
220 | 220 | $dupeId = $row->user_id; |
221 | 221 | wfOut( "... dupe id $dupeId: " ); |
222 | 222 | $edits = $this->editCount( $dupeId ); |
Index: trunk/phase3/maintenance/upgrade1_5.php |
— | — | @@ -344,7 +344,7 @@ |
345 | 345 | __METHOD__ ); |
346 | 346 | |
347 | 347 | $add = array(); |
348 | | - while ( $row = $this->dbr->fetchObject( $result ) ) { |
| 348 | + foreach ( $result as $row ) { |
349 | 349 | $copy = array(); |
350 | 350 | foreach ( $fields as $field => $source ) { |
351 | 351 | if ( $source === MW_UPGRADE_COPY ) { |
— | — | @@ -455,7 +455,7 @@ |
456 | 456 | FROM $cur |
457 | 457 | ORDER BY cur_id", __METHOD__ ); |
458 | 458 | $add = array(); |
459 | | - while ( $row = $this->dbr->fetchObject( $result ) ) { |
| 459 | + foreach ( $result as $row ) { |
460 | 460 | $add[] = array( |
461 | 461 | 'old_namespace' => $row->cur_namespace, |
462 | 462 | 'old_title' => $row->cur_title, |
— | — | @@ -488,7 +488,7 @@ |
489 | 489 | __METHOD__ ); |
490 | 490 | |
491 | 491 | $add = array(); |
492 | | - while ( $row = $this->dbr->fetchObject( $result ) ) { |
| 492 | + foreach ( $result as $row ) { |
493 | 493 | $add[] = array( |
494 | 494 | 'rev_id' => $row->old_id, |
495 | 495 | 'rev_page' => $row->cur_id, |
— | — | @@ -516,7 +516,7 @@ |
517 | 517 | WHERE cur_id=rev_page AND rev_timestamp=cur_timestamp AND rev_id > {$maxold} |
518 | 518 | ORDER BY cur_id", __METHOD__ ); |
519 | 519 | $add = array(); |
520 | | - while ( $row = $this->dbr->fetchObject( $result ) ) { |
| 520 | + foreach ( $result as $row ) { |
521 | 521 | $add[] = array( |
522 | 522 | 'page_id' => $row->cur_id, |
523 | 523 | 'page_namespace' => $row->cur_namespace, |
— | — | @@ -578,7 +578,7 @@ |
579 | 579 | FROM $links, $cur |
580 | 580 | WHERE l_to=cur_id", __METHOD__ ); |
581 | 581 | $add = array(); |
582 | | - while ( $row = $this->dbr->fetchObject( $result ) ) { |
| 582 | + foreach ( $result as $row ) { |
583 | 583 | $add[] = array( |
584 | 584 | 'pl_from' => $row->l_from, |
585 | 585 | 'pl_namespace' => $row->cur_namespace, |
— | — | @@ -598,7 +598,7 @@ |
599 | 599 | "SELECT bl_from, bl_to FROM $brokenlinks", |
600 | 600 | __METHOD__ ); |
601 | 601 | $add = array(); |
602 | | - while ( $row = $this->dbr->fetchObject( $result ) ) { |
| 602 | + foreach ( $result as $row ) { |
603 | 603 | $pagename = $this->conv( $row->bl_to ); |
604 | 604 | $title = Title::newFromText( $pagename ); |
605 | 605 | if ( is_null( $title ) ) { |
— | — | @@ -905,7 +905,7 @@ |
906 | 906 | __METHOD__ ); |
907 | 907 | |
908 | 908 | $add = array(); |
909 | | - while ( $row = $this->dbr->fetchObject( $result ) ) { |
| 909 | + foreach ( $result as $row ) { |
910 | 910 | $add[] = array( |
911 | 911 | 'wl_user' => $row->wl_user, |
912 | 912 | 'wl_namespace' => MWNamespace::getSubject( $row->wl_namespace ), |
— | — | @@ -1214,7 +1214,7 @@ |
1215 | 1215 | echo "Found $n titles with duplicate entries.\n"; |
1216 | 1216 | if ( $n > 0 ) { |
1217 | 1217 | echo "Correcting...\n"; |
1218 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 1218 | + foreach ( $res as $row ) { |
1219 | 1219 | $ns = intval( $row->cur_namespace ); |
1220 | 1220 | $title = $dbw->addQuotes( $row->cur_title ); |
1221 | 1221 | |
Index: trunk/phase3/maintenance/convertLinks.php |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | $res = $dbw->query( "SELECT cur_namespace,cur_title,cur_id FROM $cur" ); |
115 | 115 | $ids = array(); |
116 | 116 | |
117 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 117 | + foreach ( $res as $row ) { |
118 | 118 | $title = $row->cur_title; |
119 | 119 | if ( $row->cur_namespace ) { |
120 | 120 | $title = $wgContLang->getNsText( $row->cur_namespace ) . ":$title"; |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | } |
156 | 156 | |
157 | 157 | $tuplesAdded = 0; # no tuples added to INSERT yet |
158 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 158 | + foreach ( $res as $row ) { |
159 | 159 | $fromTitle = $row->l_from; |
160 | 160 | if ( array_key_exists( $fromTitle, $ids ) ) { # valid title |
161 | 161 | $from = $ids[$fromTitle]; |