Merge "Remove useless test in getParamValue function of mediawiki.util.js"
[lhc/web/wiklou.git] / includes / api / ApiQueryAllCategories.php
index ce28d03..60b57bf 100644 (file)
@@ -77,7 +77,8 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                }
 
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
-               $this->addOption( 'ORDER BY', 'cat_title' . ( $params['dir'] == 'descending' ? ' DESC' : '' ) );
+               $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+               $this->addOption( 'ORDER BY', 'cat_title' . $sort );
 
                $prop = array_flip( $params['prop'] );
                $this->addFieldsIf( array( 'cat_pages', 'cat_subcats', 'cat_files' ), isset( $prop['size'] ) );
@@ -111,7 +112,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                        // Normalize titles
                        $titleObj = Title::makeTitle( NS_CATEGORY, $row->cat_title );
                        if ( !is_null( $resultPageSet ) ) {
-                               $pages[] = $titleObj->getPrefixedText();
+                               $pages[] = $titleObj;
                        } else {
                                $item = array();
                                $result->setContent( $item, $titleObj->getText() );
@@ -191,6 +192,23 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               '*' => 'string'
+                       ),
+                       'size' => array(
+                               'size' => 'integer',
+                               'pages' => 'integer',
+                               'files' => 'integer',
+                               'subcats' => 'integer'
+                       ),
+                       'hidden' => array(
+                               'hidden' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Enumerate all categories';
        }