From: Roan Kattouw Date: Thu, 16 Oct 2008 14:28:49 +0000 (+0000) Subject: (bug 15985) Fix acfrom and aifrom breakage when sorting in descending order X-Git-Tag: 1.31.0-rc.0~44724 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=a3714f5f3718814bf3c952bc0c8a8a130f478ddf;p=lhc%2Fweb%2Fwiklou.git (bug 15985) Fix acfrom and aifrom breakage when sorting in descending order --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a146a4613b..e98ececd48 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index 47ad79fc51..9690ae3e39 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -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'])) . "%'"); diff --git a/includes/api/ApiQueryAllimages.php b/includes/api/ApiQueryAllimages.php index 8b513f34a6..93009b360c 100644 --- a/includes/api/ApiQueryAllimages.php +++ b/includes/api/ApiQueryAllimages.php @@ -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'])) . "%'");