r44590 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44589‎ | r44590 | r44591 >
Date:20:24, 14 December 2008
Author:catrope
Status:ok
Tags:
Comment:
API: (bug 16647) list=allcategories, prop=categories don't return "hidden" property for hidden categories. Patch by Brad Jorsch
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllCategories.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryCategoryInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllCategories.php
@@ -67,7 +67,19 @@
6868
6969 $prop = array_flip($params['prop']);
7070 $this->addFieldsIf( array( 'cat_pages', 'cat_subcats', 'cat_files' ), isset($prop['size']) );
71 - $this->addFieldsIf( 'cat_hidden', isset($prop['hidden']) );
 71+ if(isset($prop['hidden']))
 72+ {
 73+ $this->addTables(array('page', 'page_props'));
 74+ $this->addJoinConds(array(
 75+ 'page' => array('LEFT JOIN', array(
 76+ 'page_namespace' => NS_CATEGORY,
 77+ 'page_title=cat_title')),
 78+ 'page_props' => array('LEFT JOIN', array(
 79+ 'pp_page=page_id',
 80+ 'pp_propname' => 'hiddencat')),
 81+ ));
 82+ $this->addFields('pp_propname AS cat_hidden');
 83+ }
7284
7385 $res = $this->select(__METHOD__);
7486
Index: trunk/phase3/includes/api/ApiQueryCategoryInfo.php
@@ -55,8 +55,16 @@
5656 $cattitles[$c] = $t->getDBKey();
5757 }
5858
59 - $this->addTables('category');
60 - $this->addFields(array('cat_title', 'cat_pages', 'cat_subcats', 'cat_files', 'cat_hidden'));
 59+ $this->addTables(array('category', 'page', 'page_props'));
 60+ $this->addJoinConds(array(
 61+ 'page' => array('LEFT JOIN', array(
 62+ 'page_namespace' => NS_CATEGORY,
 63+ 'page_title=cat_title')),
 64+ 'page_props' => array('LEFT JOIN', array(
 65+ 'pp_page=page_id',
 66+ 'pp_propname' => 'hiddencat')),
 67+ ));
 68+ $this->addFields(array('cat_title', 'cat_pages', 'cat_subcats', 'cat_files', 'pp_propname AS cat_hidden'));
6169 $this->addWhere(array('cat_title' => $cattitles));
6270
6371 $db = $this->getDB();
Index: trunk/phase3/RELEASE-NOTES
@@ -516,6 +516,8 @@
517517 protection wasn't allowed
518518 * (bug 16626) action=delete now correctly handles empty "reason" param
519519 * (bug 15579) clshow considers all categories !hidden
 520+* (bug 16647) list=allcategories, prop=categories don't return "hidden"
 521+ property for hidden categories
520522
521523 === Languages updated in 1.14 ===
522524

Status & tagging log