Index: trunk/phase3/maintenance/updateRestrictions.php |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | $cond = "page_id BETWEEN $blockStart AND $blockEnd AND page_restrictions !=''"; |
56 | 56 | $res = $db->select( 'page', array('page_id','page_namespace','page_restrictions'), $cond, __METHOD__ ); |
57 | 57 | $batch = array(); |
58 | | - while( $row = $db->fetchObject( $res ) ) { |
| 58 | + foreach( $res as $row ) { |
59 | 59 | $oldRestrictions = array(); |
60 | 60 | foreach( explode( ':', trim( $row->page_restrictions ) ) as $restrict ) { |
61 | 61 | $temp = explode( '=', trim( $restrict ) ); |
Index: trunk/phase3/maintenance/deleteDefaultMessages.php |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | |
56 | 56 | $dbw = wfGetDB( DB_MASTER ); |
57 | 57 | |
58 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 58 | + foreach ( $res as $row ) { |
59 | 59 | if ( function_exists( 'wfWaitForSlaves' ) ) { |
60 | 60 | wfWaitForSlaves( 5 ); |
61 | 61 | } |
Index: trunk/phase3/maintenance/refreshLinks.php |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | $num = $dbr->numRows( $res ); |
93 | 93 | $this->output( "Refreshing $num old redirects from $start...\n" ); |
94 | 94 | |
95 | | - while( $row = $dbr->fetchObject( $res ) ) { |
| 95 | + foreach( $res as $row ) { |
96 | 96 | if ( !( ++$i % $reportingInterval ) ) { |
97 | 97 | $this->output( "$i\n" ); |
98 | 98 | wfWaitForSlaves( $maxLag ); |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | $this->output( "$num new articles...\n" ); |
113 | 113 | |
114 | 114 | $i = 0; |
115 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 115 | + foreach ( $res as $row ) { |
116 | 116 | if ( !( ++$i % $reportingInterval ) ) { |
117 | 117 | $this->output( "$i\n" ); |
118 | 118 | wfWaitForSlaves( $maxLag ); |
Index: trunk/phase3/maintenance/deleteOldRevisions.php |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | # Get "active" revisions from the page table |
64 | 64 | $this->output( "Searching for active revisions..." ); |
65 | 65 | $res = $dbw->query( "SELECT page_latest FROM $tbl_pag{$pageIdClause}" ); |
66 | | - while( $row = $dbw->fetchObject( $res ) ) { |
| 66 | + foreach( $res as $row ) { |
67 | 67 | $cur[] = $row->page_latest; |
68 | 68 | } |
69 | 69 | $this->output( "done.\n" ); |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | $this->output( "Searching for inactive revisions..." ); |
73 | 73 | $set = implode( ', ', $cur ); |
74 | 74 | $res = $dbw->query( "SELECT rev_id FROM $tbl_rev WHERE rev_id NOT IN ( $set ){$revPageClause}" ); |
75 | | - while( $row = $dbw->fetchObject( $res ) ) { |
| 75 | + foreach( $res as $row ) { |
76 | 76 | $old[] = $row->rev_id; |
77 | 77 | } |
78 | 78 | $this->output( "done.\n" ); |
Index: trunk/phase3/maintenance/removeUnusedAccounts.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | $this->error( "Please put a valid positive integer on the --ignore-touched parameter.", true ); |
53 | 53 | } |
54 | 54 | $touchedSeconds = 86400 * $touched; |
55 | | - while( $row = $dbr->fetchObject( $res ) ) { |
| 55 | + foreach( $res as $row ) { |
56 | 56 | # Check the account, but ignore it if it's within a $excludedGroups group or if it's touched within the $touchedSeconds seconds. |
57 | 57 | $instance = User::newFromId( $row->user_id ); |
58 | 58 | if( count( array_intersect( $instance->getEffectiveGroups(), $excludedGroups ) ) == 0 |
Index: trunk/phase3/maintenance/fixTimestamps.php |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | $badRevs = array(); |
71 | 71 | $numGoodRevs = 0; |
72 | 72 | |
73 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 73 | + foreach ( $res as $row ) { |
74 | 74 | $timestamp = wfTimestamp( TS_UNIX, $row->rev_timestamp ); |
75 | 75 | $delta = $timestamp - $lastNormal; |
76 | 76 | $sign = $delta == 0 ? 0 : $delta / abs( $delta ); |
Index: trunk/phase3/maintenance/namespaceDupes.php |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | private function getInterwikiList() { |
139 | 139 | $result = $this->db->select( 'interwiki', array( 'iw_prefix' ) ); |
140 | 140 | $prefixes = array(); |
141 | | - while( $row = $this->db->fetchObject( $result ) ) { |
| 141 | + foreach( $result as $row ) { |
142 | 142 | $prefixes[] = $row->iw_prefix; |
143 | 143 | } |
144 | 144 | $this->db->freeResult( $result ); |
— | — | @@ -216,7 +216,7 @@ |
217 | 217 | $result = $this->db->query( $sql, __METHOD__ ); |
218 | 218 | |
219 | 219 | $set = array(); |
220 | | - while( $row = $this->db->fetchObject( $result ) ) { |
| 220 | + foreach( $result as $row ) { |
221 | 221 | $set[] = $row; |
222 | 222 | } |
223 | 223 | $this->db->freeResult( $result ); |
Index: trunk/phase3/maintenance/nukePage.php |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | # Get corresponding revisions |
58 | 58 | $this->output( "Searching for revisions..." ); |
59 | 59 | $res = $dbw->query( "SELECT rev_id FROM $tbl_rev WHERE rev_page = $id" ); |
60 | | - while( $row = $dbw->fetchObject( $res ) ) { |
| 60 | + foreach( $res as $row ) { |
61 | 61 | $revs[] = $row->rev_id; |
62 | 62 | } |
63 | 63 | $count = count( $revs ); |
Index: trunk/phase3/maintenance/generateSitemap.php |
— | — | @@ -214,7 +214,7 @@ |
215 | 215 | ) |
216 | 216 | ); |
217 | 217 | |
218 | | - while ( $row = $this->dbr->fetchObject( $res ) ) |
| 218 | + foreach ( $res as $row ) |
219 | 219 | $this->namespaces[] = $row->page_namespace; |
220 | 220 | } |
221 | 221 | |
— | — | @@ -281,7 +281,7 @@ |
282 | 282 | |
283 | 283 | $fns = $wgContLang->getFormattedNsText( $namespace ); |
284 | 284 | $this->output( "$namespace ($fns)" ); |
285 | | - while ( $row = $this->dbr->fetchObject( $res ) ) { |
| 285 | + foreach ( $res as $row ) { |
286 | 286 | if ( $i++ === 0 || $i === $this->url_limit + 1 || $length + $this->limit[1] + $this->limit[2] > $this->size_limit ) { |
287 | 287 | if ( $this->file !== false ) { |
288 | 288 | $this->write( $this->file, $this->closeFile() ); |
Index: trunk/phase3/maintenance/fixSlaveDesync.php |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | $masterIDs = array(); |
64 | 64 | $res = $dbw->select( 'page', array( 'page_id', 'page_latest' ), array( 'page_id<6054123' ), __METHOD__ ); |
65 | 65 | $this->output( "Number of pages: " . $dbw->numRows( $res ) . "\n" ); |
66 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 66 | + foreach ( $res as $row ) { |
67 | 67 | $masterIDs[$row->page_id] = $row->page_latest; |
68 | 68 | if ( !( ++$n % 10000 ) ) { |
69 | 69 | $this->output( "$n\r" ); |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | foreach ( $slaveIndexes as $i ) { |
77 | 77 | $db = wfGetDB( $i ); |
78 | 78 | $res = $db->select( 'page', array( 'page_id', 'page_latest' ), array( 'page_id<6054123' ), __METHOD__ ); |
79 | | - while ( $row = $db->fetchObject( $res ) ) { |
| 79 | + foreach ( $res as $row ) { |
80 | 80 | if ( isset( $masterIDs[$row->page_id] ) && $masterIDs[$row->page_id] != $row->page_latest ) { |
81 | 81 | $desync[$row->page_id] = true; |
82 | 82 | $this->output( $row->page_id . "\t" ); |
— | — | @@ -128,14 +128,14 @@ |
129 | 129 | $res = $dbw->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), |
130 | 130 | __METHOD__, 'FOR UPDATE' ); |
131 | 131 | $masterIDs = array(); |
132 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 132 | + foreach ( $res as $row ) { |
133 | 133 | $masterIDs[] = $row->rev_id; |
134 | 134 | } |
135 | 135 | $dbw->freeResult( $res ); |
136 | 136 | |
137 | 137 | $res = $db->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), __METHOD__ ); |
138 | 138 | $slaveIDs = array(); |
139 | | - while ( $row = $db->fetchObject( $res ) ) { |
| 139 | + foreach ( $res as $row ) { |
140 | 140 | $slaveIDs[] = $row->rev_id; |
141 | 141 | } |
142 | 142 | $db->freeResult( $res ); |
Index: trunk/phase3/maintenance/fixUserRegistration.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | |
37 | 37 | // Get user IDs which need fixing |
38 | 38 | $res = $dbr->select( 'user', 'user_id', 'user_registration IS NULL', __METHOD__ ); |
39 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 39 | + foreach ( $res as $row ) { |
40 | 40 | $id = $row->user_id; |
41 | 41 | // Get first edit time |
42 | 42 | $timestamp = $dbr->selectField( 'revision', 'MIN(rev_timestamp)', array( 'rev_user' => $id ), __METHOD__ ); |
Index: trunk/phase3/maintenance/populateLogSearch.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | $cond = "log_id BETWEEN $blockStart AND $blockEnd"; |
55 | 55 | $res = $db->select( 'logging', '*', $cond, __FUNCTION__ ); |
56 | 56 | $batch = array(); |
57 | | - while( $row = $db->fetchObject( $res ) ) { |
| 57 | + foreach( $res as $row ) { |
58 | 58 | // RevisionDelete logs - revisions |
59 | 59 | if( LogEventsList::typeAction( $row, array('delete','suppress'), 'revision' ) ) { |
60 | 60 | $params = LogPage::extractParams( $row->log_params ); |
Index: trunk/phase3/maintenance/initEditCount.php |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | GROUP BY user_id", |
75 | 75 | __METHOD__ ); |
76 | 76 | |
77 | | - while( $row = $dbr->fetchObject( $result ) ) { |
| 77 | + foreach( $result as $row ) { |
78 | 78 | $dbw->update( 'user', |
79 | 79 | array( 'user_editcount' => $row->user_editcount ), |
80 | 80 | array( 'user_id' => $row->user_id ), |
Index: trunk/phase3/maintenance/deleteImageMemcached.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | $i = 0; |
54 | 54 | $total = $this->getImageCount(); |
55 | 55 | |
56 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 56 | + foreach ( $res as $row ) { |
57 | 57 | if ($i % $this->report == 0) |
58 | 58 | $this->output( sprintf("%s: %13s done (%s)\n", wfWikiID(), "$i/$total", wfPercent( $i / $total * 100 ) ) ); |
59 | 59 | $md5 = md5( $row->img_name ); |
Index: trunk/phase3/maintenance/dumpSisterSites.php |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | ), |
44 | 44 | __METHOD__ ); |
45 | 45 | |
46 | | - while( $row = $dbr->fetchObject( $result ) ) { |
| 46 | + foreach( $result as $row ) { |
47 | 47 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
48 | 48 | $url = $title->getFullUrl(); |
49 | 49 | $text = $title->getPrefixedText(); |
Index: trunk/phase3/maintenance/Maintenance.php |
— | — | @@ -671,7 +671,7 @@ |
672 | 672 | # Get "active" text records from the revisions table |
673 | 673 | $this->output( "Searching for active text records in revisions table..." ); |
674 | 674 | $res = $dbw->query( "SELECT DISTINCT rev_text_id FROM $tbl_rev" ); |
675 | | - while( $row = $dbw->fetchObject( $res ) ) { |
| 675 | + foreach( $res as $row ) { |
676 | 676 | $cur[] = $row->rev_text_id; |
677 | 677 | } |
678 | 678 | $this->output( "done.\n" ); |
— | — | @@ -679,7 +679,7 @@ |
680 | 680 | # Get "active" text records from the archive table |
681 | 681 | $this->output( "Searching for active text records in archive table..." ); |
682 | 682 | $res = $dbw->query( "SELECT DISTINCT ar_text_id FROM $tbl_arc" ); |
683 | | - while( $row = $dbw->fetchObject( $res ) ) { |
| 683 | + foreach( $res as $row ) { |
684 | 684 | $cur[] = $row->ar_text_id; |
685 | 685 | } |
686 | 686 | $this->output( "done.\n" ); |
— | — | @@ -689,7 +689,7 @@ |
690 | 690 | $set = implode( ', ', $cur ); |
691 | 691 | $res = $dbw->query( "SELECT old_id FROM $tbl_txt WHERE old_id NOT IN ( $set )" ); |
692 | 692 | $old = array(); |
693 | | - while( $row = $dbw->fetchObject( $res ) ) { |
| 693 | + foreach( $res as $row ) { |
694 | 694 | $old[] = $row->old_id; |
695 | 695 | } |
696 | 696 | $this->output( "done.\n" ); |
Index: trunk/phase3/maintenance/rebuildtextindex.php |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | AND rev_text_id=old_id"; |
97 | 97 | $res = $database->query($sql, "rebuildTextIndex" ); |
98 | 98 | |
99 | | - while( $s = $database->fetchObject($res) ) { |
| 99 | + foreach( $res as $s ) { |
100 | 100 | $revtext = Revision::getRevisionText( $s ); |
101 | 101 | $u = new SearchUpdate( $s->page_id, $s->page_title, $revtext ); |
102 | 102 | $u->doUpdate(); |
Index: trunk/phase3/maintenance/nukeNS.php |
— | — | @@ -55,24 +55,24 @@ |
56 | 56 | |
57 | 57 | $n_deleted = 0; |
58 | 58 | |
59 | | - while( $row = $dbw->fetchObject( $res ) ) { |
| 59 | + foreach( $res as $row ) { |
60 | 60 | //echo "$ns_name:".$row->page_title, "\n"; |
61 | | - $title = Title::newFromText($row->page_title, $ns); |
| 61 | + $title = Title::makeTitle( $ns, $row->page_title ); |
62 | 62 | $id = $title->getArticleID(); |
63 | 63 | |
64 | 64 | // Get corresponding revisions |
65 | 65 | $res2 = $dbw->query( "SELECT rev_id FROM $tbl_rev WHERE rev_page = $id" ); |
66 | 66 | $revs = array(); |
67 | 67 | |
68 | | - while( $row2 = $dbw->fetchObject( $res2 ) ) { |
| 68 | + foreach( $res2 as $row2 ) { |
69 | 69 | $revs[] = $row2->rev_id; |
70 | 70 | } |
71 | 71 | $count = count( $revs ); |
72 | 72 | |
73 | 73 | //skip anything that looks modified (i.e. multiple revs) |
74 | | - if (($count == 1)) { |
| 74 | + if ( $count == 1 ) { |
75 | 75 | #echo $title->getPrefixedText(), "\t", $count, "\n"; |
76 | | - $this->output( "delete: ", $title->getPrefixedText(), "\n" ); |
| 76 | + $this->output( "delete: " . $title->getPrefixedText() . "\n" ); |
77 | 77 | |
78 | 78 | //as much as I hate to cut & paste this, it's a little different, and |
79 | 79 | //I already have the id & revs |
— | — | @@ -86,23 +86,25 @@ |
87 | 87 | $n_deleted ++; |
88 | 88 | } |
89 | 89 | } else { |
90 | | - $this->output( "skip: ", $title->getPrefixedText(), "\n" ); |
| 90 | + $this->output( "skip: " . $title->getPrefixedText() . "\n" ); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | $dbw->commit(); |
94 | 94 | |
95 | | - if ($n_deleted > 0) { |
96 | | - #update statistics - better to decrement existing count, or just count |
97 | | - #the page table? |
98 | | - $pages = $dbw->selectField('site_stats', 'ss_total_pages'); |
99 | | - $pages -= $n_deleted; |
100 | | - $dbw->update( 'site_stats', |
101 | | - array('ss_total_pages' => $pages ), |
102 | | - array( 'ss_row_id' => 1), |
103 | | - __METHOD__ ); |
| 95 | + if ( $n_deleted > 0 ) { |
| 96 | + #update statistics - better to decrement existing count, or just count |
| 97 | + #the page table? |
| 98 | + $pages = $dbw->selectField( 'site_stats', 'ss_total_pages' ); |
| 99 | + $pages -= $n_deleted; |
| 100 | + $dbw->update( |
| 101 | + 'site_stats', |
| 102 | + array( 'ss_total_pages' => $pages ), |
| 103 | + array( 'ss_row_id' => 1 ), |
| 104 | + __METHOD__ |
| 105 | + ); |
104 | 106 | } |
105 | 107 | |
106 | | - if (!$delete) { |
| 108 | + if ( !$delete ) { |
107 | 109 | $this->output( "To update the database, run the script with the --delete option.\n" ); |
108 | 110 | } |
109 | 111 | } |
Index: trunk/phase3/maintenance/orphans.php |
— | — | @@ -84,7 +84,7 @@ |
85 | 85 | global $wgContLang; |
86 | 86 | $this->output( "$orphans orphan revisions...\n" ); |
87 | 87 | $this->output( sprintf( "%10s %10s %14s %20s %s\n", 'rev_id', 'rev_page', 'rev_timestamp', 'rev_user_text', 'rev_comment' ) ); |
88 | | - while( $row = $dbw->fetchObject( $result ) ) { |
| 88 | + foreach( $result as $row ) { |
89 | 89 | $comment = ( $row->rev_comment == '' ) |
90 | 90 | ? '' |
91 | 91 | : '(' . $wgContLang->truncate( $row->rev_comment, 40 ) . ')'; |
— | — | @@ -136,7 +136,7 @@ |
137 | 137 | global $wgContLang; |
138 | 138 | $this->output( "$widows childless pages...\n" ); |
139 | 139 | $this->output( sprintf( "%10s %11s %2s %s\n", 'page_id', 'page_latest', 'ns', 'page_title' ) ); |
140 | | - while( $row = $dbw->fetchObject( $result ) ) { |
| 140 | + foreach( $result as $row ) { |
141 | 141 | printf( "%10d %11d %2d %s\n", |
142 | 142 | $row->page_id, |
143 | 143 | $row->page_latest, |
— | — | @@ -178,7 +178,7 @@ |
179 | 179 | FROM $page LEFT OUTER JOIN $revision ON page_latest=rev_id |
180 | 180 | "); |
181 | 181 | $found = 0; |
182 | | - while( $row = $dbw->fetchObject( $result ) ) { |
| 182 | + foreach( $result as $row ) { |
183 | 183 | $result2 = $dbw->query( " |
184 | 184 | SELECT MAX(rev_timestamp) as max_timestamp |
185 | 185 | FROM $revision |
Index: trunk/phase3/maintenance/convertUserOptions.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | |
57 | 57 | function convertOptionBatch( $res, $dbw ) { |
58 | 58 | $id = null; |
59 | | - while ($row = $dbw->fetchObject( $res ) ) { |
| 59 | + foreach ( $res as $row ) { |
60 | 60 | $this->mConversionCount++; |
61 | 61 | |
62 | 62 | $u = User::newFromRow( $row ); |
Index: trunk/phase3/maintenance/populateLogUsertext.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | array('log_id','user_name'), $cond, __METHOD__ ); |
54 | 54 | $batch = array(); |
55 | 55 | $db->begin(); |
56 | | - while( $row = $db->fetchObject( $res ) ) { |
| 56 | + foreach( $res as $row ) { |
57 | 57 | $db->update( 'logging', array('log_user_text' => $row->user_name), |
58 | 58 | array('log_id' => $row->log_id), __METHOD__ ); |
59 | 59 | } |
Index: trunk/phase3/maintenance/updateSearchIndex.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | } |
101 | 101 | |
102 | 102 | # Loop through the results and do a search update |
103 | | - while ( $row = $dbw->fetchObject( $res ) ) { |
| 103 | + foreach ( $res as $row ) { |
104 | 104 | # Allow reads to be processed |
105 | 105 | if ( $maxLockTime && time() > $lockTime + $maxLockTime ) { |
106 | 106 | $this->output( " --- Relocking ---" ); |
Index: trunk/phase3/maintenance/dumpLinks.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | array( 'ORDER BY' => 'page_id' ) ); |
53 | 53 | |
54 | 54 | $lastPage = null; |
55 | | - while( $row = $dbr->fetchObject( $result ) ) { |
| 55 | + foreach( $result as $row ) { |
56 | 56 | if( $lastPage != $row->page_id ) { |
57 | 57 | if( isset( $lastPage ) ) { |
58 | 58 | $this->output( "\n" ); |
Index: trunk/phase3/maintenance/deleteOrphanedRevisions.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | |
51 | 51 | # Stash 'em all up for deletion (if needed) |
52 | 52 | $revisions = array(); |
53 | | - while( $row = $dbw->fetchObject( $res ) ) |
| 53 | + foreach( $res as $row ) |
54 | 54 | $revisions[] = $row->rev_id; |
55 | 55 | $dbw->freeResult( $res ); |
56 | 56 | $count = count( $revisions ); |
Index: trunk/phase3/maintenance/deleteArchivedFiles.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | $this->output( "Searching for and deleting archived files...\n" ); |
52 | 52 | $res = $dbw->query( "SELECT fa_id,fa_storage_group,fa_storage_key FROM $tbl_arch" ); |
53 | 53 | $count = 0; |
54 | | - while( $row = $dbw->fetchObject( $res ) ) { |
| 54 | + foreach( $res as $row ) { |
55 | 55 | $key = $row->fa_storage_key; |
56 | 56 | $group = $row->fa_storage_group; |
57 | 57 | $id = $row->fa_id; |
Index: trunk/phase3/maintenance/clear_interwiki_cache.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | $dbr = wfGetDB( DB_SLAVE ); |
37 | 37 | $res = $dbr->select( 'interwiki', array( 'iw_prefix' ), false ); |
38 | 38 | $prefixes = array(); |
39 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 39 | + foreach ( $res as $row ) { |
40 | 40 | $prefixes[] = $row->iw_prefix; |
41 | 41 | } |
42 | 42 | |
Index: trunk/phase3/maintenance/sql.php |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | if ( !$res ) { |
63 | 63 | // Do nothing |
64 | 64 | } elseif ( is_object( $res ) && $res->numRows() ) { |
65 | | - while ( $row = $res->fetchObject() ) { |
| 65 | + foreach ( $res as $row ) { |
66 | 66 | $this->output( print_r( $row, true ) ); |
67 | 67 | } |
68 | 68 | } else { |
Index: trunk/phase3/maintenance/checkUsernames.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | __METHOD__ |
43 | 43 | ); |
44 | 44 | |
45 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 45 | + foreach ( $res as $row ) { |
46 | 46 | if ( ! User::isValidUserName( $row->user_name ) ) { |
47 | 47 | $this->error( sprintf( "%s: %6d: '%s'\n", wfWikiID(), $row->user_id, $row->user_name ) ); |
48 | 48 | wfDebugLog( 'checkUsernames', $out ); |
Index: trunk/phase3/maintenance/rebuildFileCache.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | "page_id BETWEEN $blockStart AND $blockEnd" ), |
72 | 72 | array('ORDER BY' => 'page_id ASC','USE INDEX' => 'PRIMARY') |
73 | 73 | ); |
74 | | - while( $row = $dbr->fetchObject( $res ) ) { |
| 74 | + foreach( $res as $row ) { |
75 | 75 | $rebuilt = false; |
76 | 76 | $wgTitle = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); |
77 | 77 | if( null == $wgTitle ) { |
Index: trunk/phase3/maintenance/rebuildrecentchanges.php |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | |
108 | 108 | $lastCurId = 0; |
109 | 109 | $lastOldId = 0; |
110 | | - while ( $obj = $dbw->fetchObject( $res ) ) { |
| 110 | + foreach ( $res as $obj ) { |
111 | 111 | $new = 0; |
112 | 112 | if( $obj->rc_cur_id != $lastCurId ) { |
113 | 113 | # Switch! Look up the previous last edit, if any |
— | — | @@ -233,7 +233,7 @@ |
234 | 234 | "WHERE ug_group IN($botwhere) AND user_id = ug_user"; |
235 | 235 | $res = $dbw->query( $sql, DB_MASTER ); |
236 | 236 | |
237 | | - while( $obj = $dbw->fetchObject( $res ) ) { |
| 237 | + foreach( $res as $obj ) { |
238 | 238 | $botusers[] = $dbw->addQuotes( $obj->user_name ); |
239 | 239 | } |
240 | 240 | # Fill in the rc_bot field |
— | — | @@ -257,7 +257,7 @@ |
258 | 258 | "WHERE ug_group IN($patrolwhere) AND user_id = ug_user"; |
259 | 259 | $res = $dbw->query( $sql, DB_MASTER ); |
260 | 260 | |
261 | | - while( $obj = $dbw->fetchObject( $res ) ) { |
| 261 | + foreach( $res as $obj ) { |
262 | 262 | $patrolusers[] = $dbw->addQuotes( $obj->user_name ); |
263 | 263 | } |
264 | 264 | |
Index: trunk/phase3/maintenance/attachLatest.php |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | __METHOD__ ); |
45 | 45 | |
46 | 46 | $n = 0; |
47 | | - while( $row = $dbw->fetchObject( $result ) ) { |
| 47 | + foreach( $result as $row ) { |
48 | 48 | $pageId = intval( $row->page_id ); |
49 | 49 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
50 | 50 | $name = $title->getPrefixedText(); |