r36307 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36306‎ | r36307 | r36308 >
Date:20:28, 15 June 2008
Author:catrope
Status:old
Tags:
Comment:
API: Adding 'hidden' field to list=allcategories and prop=categoryinfo output
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
@@ -66,7 +66,7 @@
6767
6868 $prop = array_flip($params['prop']);
6969 $this->addFieldsIf( array( 'cat_pages', 'cat_subcats', 'cat_files' ), isset($prop['size']) );
70 - //$this->addFieldsIf( 'cat_hidden', isset($prop['hidden']) );
 70+ $this->addFieldsIf( 'cat_hidden', isset($prop['hidden']) );
7171
7272 $res = $this->select(__METHOD__);
7373
@@ -95,9 +95,8 @@
9696 $item['files'] = $row->cat_files;
9797 $item['subcats'] = $row->cat_subcats;
9898 }
99 - //Isn't populated, so doesn't work
100 - //if( isset( $prop['hidden'] ) && $row->cat_hidden )
101 - // $item['hidden'] = '';
 99+ if( isset( $prop['hidden'] ) && $row->cat_hidden )
 100+ $item['hidden'] = '';
102101 $categories[] = $item;
103102 }
104103 }
@@ -130,7 +129,7 @@
131130 ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2
132131 ),
133132 'prop' => array (
134 - ApiBase :: PARAM_TYPE => array( 'size', /*'hidden'*/ ),
 133+ ApiBase :: PARAM_TYPE => array( 'size', 'hidden' ),
135134 ApiBase :: PARAM_DFLT => '',
136135 ApiBase :: PARAM_ISMULTI => true
137136 ),
Index: trunk/phase3/includes/api/ApiQueryCategoryInfo.php
@@ -55,7 +55,7 @@
5656 }
5757
5858 $this->addTables('category');
59 - $this->addFields(array('cat_title', 'cat_pages', 'cat_subcats', 'cat_files'));
 59+ $this->addFields(array('cat_title', 'cat_pages', 'cat_subcats', 'cat_files', 'cat_hidden'));
6060 $this->addWhere(array('cat_title' => $cattitles));
6161
6262 $db = $this->getDB();
@@ -70,6 +70,8 @@
7171 $vals['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files;
7272 $vals['files'] = $row->cat_files;
7373 $vals['subcats'] = $row->cat_subcats;
 74+ if($row->cat_hidden)
 75+ $vals['hidden'] = '';
7476 $this->addPageSubItems($catids[$row->cat_title], $vals);
7577 }
7678 $db->freeResult($res);
Index: trunk/phase3/RELEASE-NOTES
@@ -445,6 +445,7 @@
446446 * (bug 14471) Use HTMLTidy and generate limit report in action=parse
447447 * (bug 14459) Added prependtext and appendtext parameters to action=edit
448448 * (bug 14526) Unescaped SQL in list=backlinks
 449+* Added 'hidden' flag to list=allcategories and prop=categoryinfo output
449450
450451 === Languages updated in 1.13 ===
451452

Status & tagging log