http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70656

Revision: 70656
Author:   nikerabbit
Date:     2010-08-07 23:43:28 +0000 (Sat, 07 Aug 2010)

Log Message:
-----------
Use for loops for iterating query results

Modified Paths:
--------------
    trunk/phase3/includes/MessageCache.php

Modified: trunk/phase3/includes/MessageCache.php
===================================================================
--- trunk/phase3/includes/MessageCache.php      2010-08-07 23:41:03 UTC (rev 
70655)
+++ trunk/phase3/includes/MessageCache.php      2010-08-07 23:43:28 UTC (rev 
70656)
@@ -343,10 +343,9 @@
 
                # Load titles for all oversized pages in the MediaWiki namespace
                $res = $dbr->select( 'page', 'page_title', $bigConds, 
__METHOD__ . "($code)-big" );
-               while ( $row = $dbr->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $cache[$row->page_title] = '!TOO BIG';
                }
-               $dbr->freeResult( $res );
 
                # Conditions to load the remaining pages with their contents
                $smallConds = $conds;
@@ -358,10 +357,9 @@
                        array( 'page_title', 'old_text', 'old_flags' ),
                        $smallConds, __METHOD__ . "($code)-small" );
 
-               for ( $row = $dbr->fetchObject( $res ); $row; $row = 
$dbr->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $cache[$row->page_title] = ' ' . 
Revision::getRevisionText( $row );
                }
-               $dbr->freeResult( $res );
 
                $cache['VERSION'] = MSG_CACHE_VERSION;
                wfProfileOut( __METHOD__ );



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to