API:
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 10 Dec 2007 16:45:01 +0000 (16:45 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 10 Dec 2007 16:45:01 +0000 (16:45 +0000)
* Replacing Title::newFromText() by Title::makeTitle(), which is more efficient
* Changing 'AtoZ' to 'ascending' throughout

includes/api/ApiQueryAllCategories.php
includes/api/ApiQueryAllpages.php

index 04f4300..9d616d2 100644 (file)
@@ -78,11 +78,12 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                        }\r
                        \r
                        // Normalize titles\r
+                       $titleObj = Title::makeTitle(NS_CATEGORY, $row->cl_to);\r
                        if(!is_null($resultPageSet))\r
-                               $titleObj = Title::newFromText('Category:' . $row->cl_to);\r
+                               $pages[] = $titleObj->getPrefixedText();\r
                        else\r
-                               $titleObj = Title::newFromText($row->cl_to);\r
-                       $pages[] = $titleObj->getPrefixedText();\r
+                               // Don't show "Category:" everywhere in non-generator mode\r
+                               $pages[] = $titleObj->getText();\r
                }\r
                $db->freeResult($res);\r
 \r
@@ -100,10 +101,10 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                        'from' => null,\r
                        'prefix' => null,\r
                        'dir' => array(\r
-                               ApiBase :: PARAM_DFLT => 'AtoZ',\r
+                               ApiBase :: PARAM_DFLT => 'ascending',\r
                                ApiBase :: PARAM_TYPE => array(\r
-                                       'AtoZ',\r
-                                       'ZtoA'\r
+                                       'ascending',\r
+                                       'descending'\r
                                ),\r
                        ),\r
                        'limit' => array (\r
index 8f7daec..0ede557 100644 (file)
@@ -186,10 +186,10 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                                ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2
                        ),
                        'dir' => array (
-                               ApiBase :: PARAM_DFLT => 'AtoZ',
+                               ApiBase :: PARAM_DFLT => 'ascending',
                                ApiBase :: PARAM_TYPE => array (
-                                       'AtoZ',
-                                       'ZtoA'
+                                       'ascending',
+                                       'descending'
                                )
                        )
                );