Indeed, this is a ResultWrapper object, so we can iterate over it: no ugly while...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 27 Jul 2008 18:14:59 +0000 (18:14 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 27 Jul 2008 18:14:59 +0000 (18:14 +0000)
includes/specials/SpecialRecentchanges.php

index 071854f..c8b430a 100644 (file)
@@ -96,22 +96,19 @@ class SpecialRecentChanges extends SpecialPage {
                $rows = array();
                $batch = new LinkBatch;
                $conds = $this->buildMainQueryConds( $opts );
-               $res = $this->doMainQuery( $conds, $opts );
-               if( $res === false ){
+               $rows = $this->doMainQuery( $conds, $opts );
+               if( $rows === false ){
                        $this->doHeader( $opts );
                        return;
                }
 
-               while( $row = $res->fetchObject() ){
-                       $rows[] = $row;
+               foreach( $rows as $row ) {
                        if ( !$feedFormat ) {
                                // User page and talk links
                                $batch->add( NS_USER, $row->rc_user_text  );
                                $batch->add( NS_USER_TALK, $row->rc_user_text  );
                        }
-
                }
-               $res->free();
 
                if ( $feedFormat ) {
                        list( $feed, $feedObj ) = $this->getFeedObject( $feedFormat );
@@ -120,7 +117,8 @@ class SpecialRecentChanges extends SpecialPage {
                        $batch->execute();
                        $this->webOutput( $rows, $opts );
                }
-       
+
+               $rows->free();
        }
 
        /**