From e06ddfd3be896bd953d3fe4b4c8457612bef6bb7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 24 Nov 2005 03:11:22 +0000 Subject: [PATCH] * (bug 146) List number of category members in Special:Categories (patch by Joel Nothman) --- RELEASE-NOTES | 2 ++ includes/SpecialCategories.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cf8f4db441..29b693f97f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -246,6 +246,8 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 2894) Enhanced Recent Changes link fixes * (bug 4059) fix 'hide minor edits' on Recentchangeslinked * (bug 3922) bidi embedding overrides on category links +* (bug 146) List number of category members in Special:Categories + (patch by Joel Nothman) === Caveats === diff --git a/includes/SpecialCategories.php b/includes/SpecialCategories.php index 3545195a4c..96151016a0 100644 --- a/includes/SpecialCategories.php +++ b/includes/SpecialCategories.php @@ -34,11 +34,14 @@ class CategoriesPage extends QueryPage { $NScat = NS_CATEGORY; $dbr =& wfGetDB( DB_SLAVE ); $categorylinks = $dbr->tableName( 'categorylinks' ); - return "SELECT DISTINCT 'Categories' as type, + $s= "SELECT 'Categories' as type, {$NScat} as namespace, cl_to as title, - 1 as value - FROM $categorylinks"; + 1 as value, + COUNT(*) as count + FROM $categorylinks + GROUP BY cl_to"; + return $s; } function sortDescending() { @@ -48,7 +51,9 @@ class CategoriesPage extends QueryPage { function formatResult( $skin, $result ) { global $wgLang; $title = Title::makeTitle( NS_CATEGORY, $result->title ); - return $skin->makeLinkObj( $title, $title->getText() ); + $plink = $skin->makeLinkObj( $title, $title->getText() ); + $nlinks = wfMsg( 'nlinks', $result->count ); + return "$plink ($nlinks)"; } } -- 2.20.1