From: Alex Z Date: Fri, 10 Jul 2009 23:46:13 +0000 (+0000) Subject: Followup to r53052 - Die if someone tries to use the namespace filter, rather than... X-Git-Tag: 1.31.0-rc.0~41009 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=20b9b187817a4acf820dd68c677791e019e7a425;p=lhc%2Fweb%2Fwiklou.git Followup to r53052 - Die if someone tries to use the namespace filter, rather than silently igoring it. Add a note if its disabled in the param description --- diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index 4363776d61..5fc9957856 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -86,9 +86,11 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { # Scanning large datasets for rare categories sucks, and I already told # how to have efficient subcategory access :-) ~~~~ (oh well, domas) global $wgMiserMode; - if (!$wgMiserMode) { - $this->addWhereFld('page_namespace', $params['namespace']); + if ( $wgMiserMode && isset($params['namespace']) ) { + $this->dieUsage("The cmnamespace option is disabled on this site", 'namespacedisabled'); } + $this->addWhereFld('page_namespace', $params['namespace']); + if($params['sort'] == 'timestamp') $this->addWhereRange('cl_timestamp', ($params['dir'] == 'asc' ? 'newer' : 'older'), $params['start'], $params['end']); else @@ -238,10 +240,9 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { } public function getParamDescription() { - return array ( + $desc = array ( 'title' => 'Which category to enumerate (required). Must include Category: prefix', 'prop' => 'What pieces of information to include', - 'namespace' => 'Only include pages in these namespaces', 'sort' => 'Property to sort by', 'dir' => 'In which direction to sort', 'start' => 'Timestamp to start listing from. Can only be used with cmsort=timestamp', @@ -251,6 +252,15 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { 'continue' => 'For large categories, give the value retured from previous query', 'limit' => 'The maximum number of pages to return.', ); + global $wgMiserMode; + // We can't remove it from the param list entirely without removing it from the + // allowed params, but then we could only silently ignore it, which could cause + // problems for people unaware of the change + if ( $wgMiserMode ) + $desc['namespace'] = 'Disabled on this site for performance reasons'; + else + $desc['namespace'] = 'Only include pages in these namespaces'; + return $desc; } public function getDescription() { @@ -269,4 +279,4 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { public function getVersion() { return __CLASS__ . ': $Id$'; } -} \ No newline at end of file +}