Also set the queue types map when rebuilding the ready queue map
[lhc/web/wiklou.git] / includes / ImageQueryPage.php
index eeec5cd..b0266cb 100644 (file)
@@ -42,16 +42,22 @@ abstract class ImageQueryPage extends QueryPage {
         */
        protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
                if ( $num > 0 ) {
-                       $gallery = new ImageGallery();
+                       $gallery = ImageGalleryBase::factory();
+                       $gallery->setContext( $this->getContext() );
 
                        # $res might contain the whole 1,000 rows, so we read up to
                        # $num [should update this to use a Pager]
-                       for ( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
+                       $i = 0;
+                       foreach ( $res as $row ) {
+                               $i++;
                                $namespace = isset( $row->namespace ) ? $row->namespace : NS_FILE;
                                $title = Title::makeTitleSafe( $namespace, $row->title );
                                if ( $title instanceof Title && $title->getNamespace() == NS_FILE ) {
                                        $gallery->add( $title, $this->getCellHtml( $row ) );
                                }
+                               if ( $i === $num ) {
+                                       break;
+                               }
                        }
 
                        $out->addHTML( $gallery->toHtml() );
@@ -59,7 +65,8 @@ abstract class ImageQueryPage extends QueryPage {
        }
 
        // Gotta override this since it's abstract
-       function formatResult( $skin, $result ) { }
+       function formatResult( $skin, $result ) {
+       }
 
        /**
         * Get additional HTML to be shown in a results' cell