MediaWiki r42142 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r42141‎ | r42142 (on ViewVC)‎ | r42143 >
Date:14:28, 16 October 2008
Author:catrope
Status:old
Tags:
Comment:
(bug 15985) Fix acfrom and aifrom breakage when sorting in descending order
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllCategories.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryAllCategories.php	(revision 42141)
+++ trunk/phase3/includes/api/ApiQueryAllCategories.php	(revision 42142)
@@ -56,8 +56,9 @@
 		$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: trunk/phase3/includes/api/ApiQueryAllimages.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryAllimages.php	(revision 42141)
+++ trunk/phase3/includes/api/ApiQueryAllimages.php	(revision 42142)
@@ -61,8 +61,9 @@
 		$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'])) . "%'");
 
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 42141)
+++ trunk/phase3/RELEASE-NOTES	(revision 42142)
@@ -337,6 +337,8 @@
 * 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 ===
 

Status & tagging log

  • 17:05, 4 January 2012 Johnduhart (Talk | contribs) changed the tags for r42142 [removed: api]
  • 15:36, 12 September 2011 Meno25 (Talk | contribs) changed the status of r42142 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox