From: Aryeh Gregor Date: Thu, 20 Mar 2008 00:49:02 +0000 (+0000) Subject: Use category table for more efficient display of Special:Categories. I never realize... X-Git-Tag: 1.31.0-rc.0~48962 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=4ae48a6ad64e4600a53cb9f9e81041fae7b25c21;p=lhc%2Fweb%2Fwiklou.git Use category table for more efficient display of Special:Categories. I never realized how awesome our frameworks for this kind of boilerplate special page were. This was a two-minute job. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 626fd5c3bf..cd279b71e5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/SpecialCategories.php b/includes/SpecialCategories.php index ed2259d576..db6ed26ab7 100644 --- a/includes/SpecialCategories.php +++ b/includes/SpecialCategories.php @@ -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"; } }