From: Roan Kattouw Date: Sun, 14 Dec 2008 20:24:23 +0000 (+0000) Subject: API: (bug 16647) list=allcategories, prop=categories don't return "hidden" property... X-Git-Tag: 1.31.0-rc.0~43965 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=38de20ffeb0cb036b8d9accad69de35978e72aa0;p=lhc%2Fweb%2Fwiklou.git API: (bug 16647) list=allcategories, prop=categories don't return "hidden" property for hidden categories. Patch by Brad Jorsch --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bb2d9575fc..c9eb852158 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -516,6 +516,8 @@ The following extensions are migrated into MediaWiki 1.14: protection wasn't allowed * (bug 16626) action=delete now correctly handles empty "reason" param * (bug 15579) clshow considers all categories !hidden +* (bug 16647) list=allcategories, prop=categories don't return "hidden" + property for hidden categories === Languages updated in 1.14 === diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index 9690ae3e39..b8c06e9572 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -67,7 +67,19 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { $prop = array_flip($params['prop']); $this->addFieldsIf( array( 'cat_pages', 'cat_subcats', 'cat_files' ), isset($prop['size']) ); - $this->addFieldsIf( 'cat_hidden', isset($prop['hidden']) ); + if(isset($prop['hidden'])) + { + $this->addTables(array('page', 'page_props')); + $this->addJoinConds(array( + 'page' => array('LEFT JOIN', array( + 'page_namespace' => NS_CATEGORY, + 'page_title=cat_title')), + 'page_props' => array('LEFT JOIN', array( + 'pp_page=page_id', + 'pp_propname' => 'hiddencat')), + )); + $this->addFields('pp_propname AS cat_hidden'); + } $res = $this->select(__METHOD__); diff --git a/includes/api/ApiQueryCategoryInfo.php b/includes/api/ApiQueryCategoryInfo.php index d495655fca..1b578b5b49 100644 --- a/includes/api/ApiQueryCategoryInfo.php +++ b/includes/api/ApiQueryCategoryInfo.php @@ -55,8 +55,16 @@ class ApiQueryCategoryInfo extends ApiQueryBase { $cattitles[$c] = $t->getDBKey(); } - $this->addTables('category'); - $this->addFields(array('cat_title', 'cat_pages', 'cat_subcats', 'cat_files', 'cat_hidden')); + $this->addTables(array('category', 'page', 'page_props')); + $this->addJoinConds(array( + 'page' => array('LEFT JOIN', array( + 'page_namespace' => NS_CATEGORY, + 'page_title=cat_title')), + 'page_props' => array('LEFT JOIN', array( + 'pp_page=page_id', + 'pp_propname' => 'hiddencat')), + )); + $this->addFields(array('cat_title', 'cat_pages', 'cat_subcats', 'cat_files', 'pp_propname AS cat_hidden')); $this->addWhere(array('cat_title' => $cattitles)); $db = $this->getDB();