r39504 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39503‎ | r39504 | r39505 >
Date:21:21, 16 August 2008
Author:catrope
Status:old
Tags:
Comment:
(bug 15178) Added clshow to prop=categories to allow filtering for hidden/non-hidden categories
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryCategories.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryCategories.php
@@ -54,6 +54,7 @@
5555
5656 $params = $this->extractRequestParams();
5757 $prop = $params['prop'];
 58+ $show = array_flip((array)$params['show']);
5859
5960 $this->addFields(array (
6061 'cl_from',
@@ -91,6 +92,15 @@
9293 "(cl_from = $clfrom AND ".
9394 "cl_to >= '$clto')");
9495 }
 96+ if(isset($show['hidden']) && isset($show['!hidden']))
 97+ $this->dieUsage("Incorrect parameter - mutually exclusive values may not be supplied", 'show');
 98+ if(isset($show['hidden']) || isset($show['!hidden']))
 99+ {
 100+ $this->addTables('category');
 101+ $this->addWhere(array( 'cl_to = cat_title',
 102+ 'cat_hidden' => isset($show['hidden'])));
 103+ }
 104+
95105 # Don't order by cl_from if it's constant in the WHERE clause
96106 if(count($this->getPageSet()->getGoodTitles()) == 1)
97107 $this->addOption('ORDER BY', 'cl_to');
@@ -166,6 +176,13 @@
167177 'timestamp',
168178 )
169179 ),
 180+ 'show' => array(
 181+ ApiBase :: PARAM_ISMULTI => true,
 182+ ApiBase :: PARAM_TYPE => array(
 183+ 'hidden',
 184+ '!hidden',
 185+ )
 186+ ),
170187 'limit' => array(
171188 ApiBase :: PARAM_DFLT => 10,
172189 ApiBase :: PARAM_TYPE => 'limit',
@@ -181,6 +198,7 @@
182199 return array (
183200 'prop' => 'Which additional properties to get for each category.',
184201 'limit' => 'How many categories to return',
 202+ 'show' => 'Which kind of categories to show',
185203 'continue' => 'When more results are available, use this to continue',
186204 );
187205 }
Index: trunk/phase3/RELEASE-NOTES
@@ -151,6 +151,8 @@
152152 output.
153153 * When the limit on multivalue parameters is exceeded, a warning is issued
154154 * list=search doesn't list missing pages any more
 155+* (bug 15178) Added clshow to prop=categories to allow filtering for hidden/
 156+ non-hidden categories
155157
156158 === Languages updated in 1.14 ===
157159

Status & tagging log