(bug 30836) API siteinfo specialpagealiases should not return nonexistent special...
[lhc/web/wiklou.git] / includes / api / ApiQueryCategories.php
index 243d1ac..283eb13 100644 (file)
@@ -124,14 +124,14 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
 
                $this->addOption( 'USE INDEX', array( 'categorylinks' => 'cl_from' ) );
 
-               $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+               $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
                // Don't order by cl_from if it's constant in the WHERE clause
                if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) {
-                       $this->addOption( 'ORDER BY', 'cl_to' . $dir );
+                       $this->addOption( 'ORDER BY', 'cl_to' . $sort );
                } else {
                        $this->addOption( 'ORDER BY', array(
-                                               'cl_from' . $dir,
-                                               'cl_to' . $dir
+                                               'cl_from' . $sort,
+                                               'cl_to' . $sort
                        ));
                }
 
@@ -240,6 +240,25 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'sortkey' => array(
+                               'sortkey' => 'string',
+                               'sortkeyprefix' => 'string'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'hidden' => array(
+                               'hidden' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'List all categories the page(s) belong to';
        }