Use category table for more efficient display of Special:Categories. I never realize...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 20 Mar 2008 00:49:02 +0000 (00:49 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 20 Mar 2008 00:49:02 +0000 (00:49 +0000)
RELEASE-NOTES
includes/SpecialCategories.php

index 626fd5c..cd279b7 100644 (file)
@@ -48,6 +48,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Add updatelog table to reliably permit updates that don't change the schema
 * Add category table to allow better tracking of category membership counts
 ** (bug 1212) Give correct membership counts on the pages of large categories
+** Use category table for more efficient display of Special:Categories
 * (bug 1459) Search for duplicate files by hash: Special:FileDuplicateSearch
 
 === Bug fixes in 1.13 ===
index ed2259d..db6ed26 100644 (file)
@@ -24,14 +24,13 @@ class CategoryPager extends AlphabeticPager {
        function getQueryInfo() {
                global $wgRequest;
                return array(
-                       'tables' => array('categorylinks'),
-                       'fields' => array('cl_to','count(*) AS count'),
-                       'options' => array('GROUP BY' => 'cl_to')
-                       );
+                       'tables' => array('category'),
+                       'fields' => array('cat_title','cat_pages')
+               );
        }
        
        function getIndexField() {
-               return "cl_to";
+               return "cat_title";
        }
        
        /* Override getBody to apply LinksBatch on resultset before actually outputting anything. */
@@ -44,7 +43,7 @@ class CategoryPager extends AlphabeticPager {
                $this->mResult->rewind();
                
                while ( $row = $this->mResult->fetchObject() ) {
-                       $batch->addObj( Title::makeTitleSafe( NS_CATEGORY, $row->cl_to ) );
+                       $batch->addObj( Title::makeTitleSafe( NS_CATEGORY, $row->cat_title ) );
                }
                $batch->execute();
                $this->mResult->rewind();
@@ -53,10 +52,10 @@ class CategoryPager extends AlphabeticPager {
        
        function formatRow($result) {
                global $wgLang;
-               $title = Title::makeTitle( NS_CATEGORY, $result->cl_to );
+               $title = Title::makeTitle( NS_CATEGORY, $result->cat_title );
                $titleText = $this->getSkin()->makeLinkObj( $title, htmlspecialchars( $title->getText() ) );
                $count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
-                               $wgLang->formatNum( $result->count ) );
+                               $wgLang->formatNum( $result->cat_pages ) );
                return Xml::tags('li', null, "$titleText ($count)" ) . "\n";
        }
 }