Make search enforced by API in search by setting PARAM_REQUIRED
[lhc/web/wiklou.git] / includes / api / ApiQueryCategoryMembers.php
index d361bf3..1eb7a04 100644 (file)
@@ -43,6 +43,10 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                $this->run();
        }
 
+       public function getCacheMode( $params ) {
+               return 'public';
+       }
+
        public function executeGenerator( $resultPageSet ) {
                $this->run( $resultPageSet );
        }
@@ -50,9 +54,6 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
        private function run( $resultPageSet = null ) {
                $params = $this->extractRequestParams();
 
-               if ( !isset( $params['title'] ) || is_null( $params['title'] ) ) {
-                       $this->dieUsage( 'The cmtitle parameter is required', 'notitle' );
-               }
                $categoryTitle = Title::newFromText( $params['title'] );
 
                if ( is_null( $categoryTitle ) || $categoryTitle->getNamespace() != NS_CATEGORY ) {
@@ -104,9 +105,6 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                $limit = $params['limit'];
                $this->addOption( 'LIMIT', $limit + 1 );
 
-               $db = $this->getDB();
-
-               $data = array();
                $count = 0;
                $lastSortKey = null;
                $res = $this->select( __METHOD__ );
@@ -207,7 +205,11 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
 
        public function getAllowedParams() {
                return array(
-                       'title' => null,
+                       'title' => array(
+                               ApiBase::PARAM_TYPE => 'string',
+                               ApiBase::PARAM_REQUIRED => true
+                       ),
+
                        'prop' => array(
                                ApiBase::PARAM_DFLT => 'ids|title',
                                ApiBase::PARAM_ISMULTI => true,
@@ -260,7 +262,13 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                $p = $this->getModulePrefix();
                $desc = array(
                        'title' => 'Which category to enumerate (required). Must include Category: prefix',
-                       'prop' => 'What pieces of information to include',
+                       'prop' => array(
+                               'What pieces of information to include',
+                               ' ids        - Adds the page id',
+                               ' title      - Adds the title and namespace id of the page',
+                               ' sortkey    - Adds the sortkey used for the category',
+                               ' timestamp  - Adds the timestamp of when the page was included',
+                       ),
                        'namespace' => 'Only include pages in these namespaces',
                        'sort' => 'Property to sort by',
                        'dir' => 'In which direction to sort',