From 1c9d35339010d5f3166ba34e770c8526c00720e4 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sun, 14 Dec 2008 17:39:50 +0000 Subject: [PATCH] API: (bug 15579) clshow considers all categories !hidden. Modified patch by Brad Jorsch --- RELEASE-NOTES | 1 + includes/api/ApiQueryCategories.php | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index feca50a742..bb2d9575fc 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -515,6 +515,7 @@ The following extensions are migrated into MediaWiki 1.14: * (bug 16613) action=protect doesn't tell when &cascade was set but cascading protection wasn't allowed * (bug 16626) action=delete now correctly handles empty "reason" param +* (bug 15579) clshow considers all categories !hidden === Languages updated in 1.14 === diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index bfba5eb4eb..cbff86bd0f 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.php @@ -96,9 +96,20 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { $this->dieUsage("Incorrect parameter - mutually exclusive values may not be supplied", 'show'); if(isset($show['hidden']) || isset($show['!hidden'])) { - $this->addTables('category'); - $this->addWhere(array( 'cl_to = cat_title', - 'cat_hidden' => isset($show['hidden']))); + $this->addOption('STRAIGHT_JOIN'); + $this->addTables(array('page', 'page_props')); + $this->addJoinConds(array( + 'page' => array('LEFT JOIN', array( + 'page_namespace' => NS_CATEGORY, + 'page_title = cl_to')), + 'page_props' => array('LEFT JOIN', array( + 'pp_page=page_id', + 'pp_propname' => 'hiddencat')) + )); + if(isset($show['hidden'])) + $this->addWhere(array('pp_propname IS NOT NULL')); + else + $this->addWhere(array('pp_propname IS NULL')); } # Don't order by cl_from if it's constant in the WHERE clause -- 2.20.1