MediaWiki r42169 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r42168‎ | r42169 (on ViewVC)‎ | r42170 >
Date:14:26, 17 October 2008
Author:catrope
Status:old
Tags:
Comment:
* API: (bug 15995) Added cmstartsortkey and cmendsortkey parameters to list=categorymembers, mirroring cmstart and cmend for timestamps
* Drop useless and possibly filesorting ORDER BY cl_to from list=categorymembers
* Handle ORDER BY cl_sortkey, cl_from (possibly with DESC appended to each of them) with addWhereRange() calls
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryCategoryMembers.php	(revision 42168)
+++ trunk/phase3/includes/api/ApiQueryCategoryMembers.php	(revision 42169)
@@ -76,17 +76,9 @@
 		$this->addTables(array('page','categorylinks'));	// must be in this order for 'USE INDEX'
 									// Not needed after bug 10280 is applied to servers
 		if($params['sort'] == 'timestamp')
-		{
 			$this->addOption('USE INDEX', 'cl_timestamp');
-			// cl_timestamp will be added by addWhereRange() later
-			$this->addOption('ORDER BY', 'cl_to');
-		}
 		else
-		{
-			$dir = ($params['dir'] == 'desc' ? ' DESC' : '');
 			$this->addOption('USE INDEX', 'cl_sortkey');
-			$this->addOption('ORDER BY', 'cl_to, cl_sortkey' . $dir . ', cl_from' . $dir);
-		}
 
 		$this->addWhere('cl_from=page_id');
 		$this->setContinuation($params['continue'], $params['dir']);
@@ -94,6 +86,11 @@
 		$this->addWhereFld('page_namespace', $params['namespace']);
 		if($params['sort'] == 'timestamp')
 			$this->addWhereRange('cl_timestamp', ($params['dir'] == 'asc' ? 'newer' : 'older'), $params['start'], $params['end']);
+		else
+		{
+			$this->addWhereRange('cl_sortkey', ($params['dir'] == 'asc' ? 'newer' : 'older'), $params['startsortkey'], $params['endsortkey']);
+			$this->addWhereRange('cl_from', ($params['dir'] == 'asc' ? 'newer' : 'older'), null, null);
+		}
 
 		$limit = $params['limit'];
 		$this->addOption('LIMIT', $limit +1);
@@ -225,7 +222,9 @@
 			),
 			'end' => array(
 				ApiBase :: PARAM_TYPE => 'timestamp'
-			)
+			),
+			'startsortkey' => null,
+			'endsortkey' => null,
 		);
 	}
 
@@ -238,6 +237,8 @@
 			'dir' => 'In which direction to sort',
 			'start' => 'Timestamp to start listing from. Can only be used with cmsort=timestamp',
 			'end' => 'Timestamp to end listing at. Can only be used with cmsort=timestamp',
+			'startsortkey' => 'Sortkey to start listing from. Can only be used with cmsort=sortkey',
+			'endsortkey' => 'Sortkey to end listing at. Can only be used with cmsort=sortkey',
 			'continue' => 'For large categories, give the value retured from previous query',
 			'limit' => 'The maximum number of pages to return.',
 		);
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 42168)
+++ trunk/phase3/RELEASE-NOTES	(revision 42169)
@@ -339,6 +339,8 @@
   and patrolmarks right
 * (bug 15985) acfrom and aifrom parameters didn't work when sorting in
   descending order.
+* (bug 15995) Add cmstartsortkey and cmendsortkey parameters to
+  list=categorymembers
 
 === Languages updated in 1.14 ===
 

Status & tagging log

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