API:
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 7 May 2008 10:06:06 +0000 (10:06 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 7 May 2008 10:06:06 +0000 (10:06 +0000)
* (bug 13993) apfrom doesn't work for apdir=descending
* Also removed unnecessary ORDER BY page_namespace which caused a filesort for some crazy reason (no noticeable performance impact though)

RELEASE-NOTES
includes/api/ApiQueryAllpages.php

index a00c721..7c8bd89 100644 (file)
@@ -313,6 +313,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 13735) Added prop=categoryinfo module
 * (bug 13945) Retrieve cascading protection sources via inprop=protection
 * (bug 13965) Hardcoded 51 limit on titles is too limiting
+* (bug 13993) apfrom doesn't work with apdir=descending
 
 === Languages updated in 1.13 ===
 
index eb826f1..4758542 100644 (file)
@@ -60,8 +60,9 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                if (!$this->addWhereIf('page_is_redirect = 1', $params['filterredir'] === 'redirects'))
                        $this->addWhereIf('page_is_redirect = 0', $params['filterredir'] === 'nonredirects');
                $this->addWhereFld('page_namespace', $params['namespace']);
-               if (!is_null($params['from']))
-                       $this->addWhere('page_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from'])));
+               $dir = ($params['dir'] == 'descending' ? 'older' : 'newer');
+               $from = (is_null($params['from']) ? null : ApiQueryBase::titleToKey($params['from']));
+               $this->addWhereRange('page_title', $dir, $from, null);
                if (isset ($params['prefix']))
                        $this->addWhere("page_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
 
@@ -124,9 +125,6 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
 
                $limit = $params['limit'];
                $this->addOption('LIMIT', $limit+1);
-               $this->addOption('ORDER BY', 'page_namespace, page_title' .
-                                               ($params['dir'] == 'descending' ? ' DESC' : ''));
-
                $res = $this->select(__METHOD__);
 
                $data = array ();