(bug 15985) Fix acfrom and aifrom breakage when sorting in descending order
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 16 Oct 2008 14:28:49 +0000 (14:28 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 16 Oct 2008 14:28:49 +0000 (14:28 +0000)
RELEASE-NOTES
includes/api/ApiQueryAllCategories.php
includes/api/ApiQueryAllimages.php

index a146a46..e98ecec 100644 (file)
@@ -337,6 +337,8 @@ The following extensions are migrated into MediaWiki 1.14:
 * The maxage and smaxage parameters are now properly validated
 * (bug 15945) list=recentchanges doesn't check $wgUseRCPatrol, $wgUseNPPatrol
   and patrolmarks right
+* (bug 15985) acfrom and aifrom parameters didn't work when sorting in
+  descending order.
 
 === Languages updated in 1.14 ===
 
index 47ad79f..9690ae3 100644 (file)
@@ -56,8 +56,9 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                $this->addTables('category');
                $this->addFields('cat_title');
 
-               if (!is_null($params['from']))
-                       $this->addWhere('cat_title>=' . $db->addQuotes($this->titlePartToKey($params['from'])));
+               $dir = ($params['dir'] == 'descending' ? 'older' : 'newer');
+               $from = (is_null($params['from']) ? null : $this->titlePartToKey($params['from']));
+               $this->addWhereRange('cat_title', $dir, $from, null);
                if (isset ($params['prefix']))
                        $this->addWhere("cat_title LIKE '" . $db->escapeLike($this->titlePartToKey($params['prefix'])) . "%'");
 
index 8b513f3..93009b3 100644 (file)
@@ -61,8 +61,9 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
                $params = $this->extractRequestParams();
 
                // Image filters
-               if (!is_null($params['from']))
-                       $this->addWhere('img_name>=' . $db->addQuotes($this->titlePartToKey($params['from'])));
+               $dir = ($params['dir'] == 'descending' ? 'older' : 'newer');
+               $from = (is_null($params['from']) ? null : $this->titlePartToKey($params['from']));
+               $this->addWhereRange('img_name', $dir, $from, null);
                if (isset ($params['prefix']))
                        $this->addWhere("img_name LIKE '" . $db->escapeLike($this->titlePartToKey($params['prefix'])) . "%'");