Index: trunk/phase3/includes/Article.php |
— | — | @@ -1977,7 +1977,7 @@ |
1978 | 1978 | $row = $dbw->fetchObject($res); |
1979 | 1979 | $onlyAuthor = $row->rev_user_text; |
1980 | 1980 | // Try to find a second contributor |
1981 | | - while( $row = $dbw->fetchObject($res) ) { |
| 1981 | + foreach( $res as $row ) { |
1982 | 1982 | if($row->rev_user_text != $onlyAuthor) { |
1983 | 1983 | $onlyAuthor = false; |
1984 | 1984 | break; |
— | — | @@ -3281,11 +3281,9 @@ |
3282 | 3282 | array( 'tl_namespace', 'tl_title' ), |
3283 | 3283 | array( 'tl_from' => $id ), |
3284 | 3284 | __METHOD__ ); |
3285 | | - if ( false !== $res ) { |
3286 | | - if ( $dbr->numRows( $res ) ) { |
3287 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
3288 | | - $result[] = Title::makeTitle( $row->tl_namespace, $row->tl_title ); |
3289 | | - } |
| 3285 | + if( false !== $res ) { |
| 3286 | + foreach( $res as $row ) { |
| 3287 | + $result[] = Title::makeTitle( $row->tl_namespace, $row->tl_title ); |
3290 | 3288 | } |
3291 | 3289 | } |
3292 | 3290 | $dbr->freeResult( $res ); |
— | — | @@ -3312,10 +3310,8 @@ |
3313 | 3311 | 'page_namespace' => NS_CATEGORY, 'page_title=cl_to'), |
3314 | 3312 | __METHOD__ ); |
3315 | 3313 | if ( false !== $res ) { |
3316 | | - if ( $dbr->numRows( $res ) ) { |
3317 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
3318 | | - $result[] = Title::makeTitle( NS_CATEGORY, $row->cl_to ); |
3319 | | - } |
| 3314 | + foreach( $res as $row ) { |
| 3315 | + $result[] = Title::makeTitle( NS_CATEGORY, $row->cl_to ); |
3320 | 3316 | } |
3321 | 3317 | } |
3322 | 3318 | $dbr->freeResult( $res ); |
— | — | @@ -3413,10 +3409,8 @@ |
3414 | 3410 | global $wgContLang; |
3415 | 3411 | |
3416 | 3412 | if ( false !== $res ) { |
3417 | | - if ( $dbr->numRows( $res ) ) { |
3418 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
3419 | | - $tlTemplates[] = $wgContLang->getNsText( $row->tl_namespace ) . ':' . $row->tl_title ; |
3420 | | - } |
| 3413 | + foreach( $res as $row ) { |
| 3414 | + $tlTemplates[] = $wgContLang->getNsText( $row->tl_namespace ) . ':' . $row->tl_title ; |
3421 | 3415 | } |
3422 | 3416 | } |
3423 | 3417 | |
Index: trunk/phase3/includes/TitleArray.php |
— | — | @@ -51,6 +51,10 @@ |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
| 55 | + public function count() { |
| 56 | + return $this->res->numRows(); |
| 57 | + } |
| 58 | + |
55 | 59 | function current() { |
56 | 60 | return $this->current; |
57 | 61 | } |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -209,7 +209,7 @@ |
210 | 210 | 'page_id IN (' . $dbr->makeList( $ids ) . ')', __METHOD__ ); |
211 | 211 | |
212 | 212 | $titles = array(); |
213 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| 213 | + foreach( $res as $row ) { |
214 | 214 | $titles[] = Title::makeTitle( $row->page_namespace, $row->page_title ); |
215 | 215 | } |
216 | 216 | return $titles; |
— | — | @@ -1661,7 +1661,7 @@ |
1662 | 1662 | $now = wfTimestampNow(); |
1663 | 1663 | $purgeExpired = false; |
1664 | 1664 | |
1665 | | - while( $row = $dbr->fetchObject( $res ) ) { |
| 1665 | + foreach( $res as $row ) { |
1666 | 1666 | $expiry = Block::decodeExpiry( $row->pr_expiry ); |
1667 | 1667 | if( $expiry > $now ) { |
1668 | 1668 | if ($get_pages) { |
— | — | @@ -1750,7 +1750,7 @@ |
1751 | 1751 | $now = wfTimestampNow(); |
1752 | 1752 | $purgeExpired = false; |
1753 | 1753 | |
1754 | | - while ($row = $dbr->fetchObject( $res ) ) { |
| 1754 | + foreach( $res as $row ) { |
1755 | 1755 | # Cycle through all the restrictions. |
1756 | 1756 | |
1757 | 1757 | // Don't take care of restrictions types that aren't in $wgRestrictionTypes |
— | — | @@ -2277,12 +2277,12 @@ |
2278 | 2278 | "{$prefix}_from=page_id", |
2279 | 2279 | "{$prefix}_namespace" => $this->getNamespace(), |
2280 | 2280 | "{$prefix}_title" => $this->getDBkey() ), |
2281 | | - 'Title::getLinksTo', |
| 2281 | + __METHOD__, |
2282 | 2282 | $options ); |
2283 | 2283 | |
2284 | 2284 | $retVal = array(); |
2285 | 2285 | if ( $db->numRows( $res ) ) { |
2286 | | - while ( $row = $db->fetchObject( $res ) ) { |
| 2286 | + foreach( $res as $row ) { |
2287 | 2287 | if ( $titleObj = Title::makeTitle( $row->page_namespace, $row->page_title ) ) { |
2288 | 2288 | $linkCache->addGoodLinkObj( $row->page_id, $titleObj, $row->page_len, $row->page_is_redirect ); |
2289 | 2289 | $retVal[] = $titleObj; |
— | — | @@ -2342,7 +2342,7 @@ |
2343 | 2343 | |
2344 | 2344 | $retVal = array(); |
2345 | 2345 | if ( $db->numRows( $res ) ) { |
2346 | | - while ( $row = $db->fetchObject( $res ) ) { |
| 2346 | + foreach( $res as $row ) { |
2347 | 2347 | $retVal[] = Title::makeTitle( $row->pl_namespace, $row->pl_title ); |
2348 | 2348 | } |
2349 | 2349 | } |
— | — | @@ -2890,9 +2890,9 @@ |
2891 | 2891 | $res = $dbr->query( $sql ); |
2892 | 2892 | |
2893 | 2893 | if( $dbr->numRows( $res ) > 0 ) { |
2894 | | - while( $x = $dbr->fetchObject( $res ) ) |
2895 | | - //$data[] = Title::newFromText($wgContLang->getNSText ( NS_CATEGORY ).':'.$x->cl_to); |
2896 | | - $data[$wgContLang->getNSText( NS_CATEGORY ).':'.$x->cl_to] = $this->getFullText(); |
| 2894 | + foreach( $res as $row ) |
| 2895 | + //$data[] = Title::newFromText($wgContLang->getNSText ( NS_CATEGORY ).':'.$row->cl_to); |
| 2896 | + $data[$wgContLang->getNSText( NS_CATEGORY ).':'.$row->cl_to] = $this->getFullText(); |
2897 | 2897 | $dbr->freeResult( $res ); |
2898 | 2898 | } else { |
2899 | 2899 | $data = array(); |
— | — | @@ -3205,7 +3205,7 @@ |
3206 | 3206 | ); |
3207 | 3207 | if ( !is_null($ns) ) $where['page_namespace'] = $ns; |
3208 | 3208 | |
3209 | | - $result = $dbr->select( |
| 3209 | + $res = $dbr->select( |
3210 | 3210 | array( 'redirect', 'page' ), |
3211 | 3211 | array( 'page_namespace', 'page_title' ), |
3212 | 3212 | $where, |
— | — | @@ -3213,7 +3213,7 @@ |
3214 | 3214 | ); |
3215 | 3215 | |
3216 | 3216 | |
3217 | | - while( $row = $dbr->fetchObject( $result ) ) { |
| 3217 | + foreach( $res as $row ) { |
3218 | 3218 | $redirs[] = self::newFromRow( $row ); |
3219 | 3219 | } |
3220 | 3220 | return $redirs; |
Index: trunk/phase3/includes/PageHistory.php |
— | — | @@ -444,20 +444,14 @@ |
445 | 445 | |
446 | 446 | $page_id = $this->mTitle->getArticleID(); |
447 | 447 | |
448 | | - $res = $dbr->select( |
| 448 | + return $dbr->select( |
449 | 449 | 'revision', |
450 | 450 | Revision::selectFields(), |
451 | 451 | array_merge(array("rev_page=$page_id"), $offsets), |
452 | 452 | __METHOD__, |
453 | 453 | array('ORDER BY' => "rev_timestamp $dirs", |
454 | 454 | 'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit) |
455 | | - ); |
456 | | - |
457 | | - $result = array(); |
458 | | - while (($obj = $dbr->fetchObject($res)) != NULL) |
459 | | - $result[] = $obj; |
460 | | - |
461 | | - return $result; |
| 455 | + ); |
462 | 456 | } |
463 | 457 | |
464 | 458 | /** @todo document */ |
Index: trunk/phase3/includes/UserArray.php |
— | — | @@ -36,6 +36,10 @@ |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
| 40 | + public function count() { |
| 41 | + return $this->res->numRows(); |
| 42 | + } |
| 43 | + |
40 | 44 | function current() { |
41 | 45 | return $this->current; |
42 | 46 | } |