r42169 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42168‎ | r42169 | 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:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryCategoryMembers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php
@@ -76,17 +76,9 @@
7777 $this->addTables(array('page','categorylinks')); // must be in this order for 'USE INDEX'
7878 // Not needed after bug 10280 is applied to servers
7979 if($params['sort'] == 'timestamp')
80 - {
8180 $this->addOption('USE INDEX', 'cl_timestamp');
82 - // cl_timestamp will be added by addWhereRange() later
83 - $this->addOption('ORDER BY', 'cl_to');
84 - }
8581 else
86 - {
87 - $dir = ($params['dir'] == 'desc' ? ' DESC' : '');
8882 $this->addOption('USE INDEX', 'cl_sortkey');
89 - $this->addOption('ORDER BY', 'cl_to, cl_sortkey' . $dir . ', cl_from' . $dir);
90 - }
9183
9284 $this->addWhere('cl_from=page_id');
9385 $this->setContinuation($params['continue'], $params['dir']);
@@ -94,6 +86,11 @@
9587 $this->addWhereFld('page_namespace', $params['namespace']);
9688 if($params['sort'] == 'timestamp')
9789 $this->addWhereRange('cl_timestamp', ($params['dir'] == 'asc' ? 'newer' : 'older'), $params['start'], $params['end']);
 90+ else
 91+ {
 92+ $this->addWhereRange('cl_sortkey', ($params['dir'] == 'asc' ? 'newer' : 'older'), $params['startsortkey'], $params['endsortkey']);
 93+ $this->addWhereRange('cl_from', ($params['dir'] == 'asc' ? 'newer' : 'older'), null, null);
 94+ }
9895
9996 $limit = $params['limit'];
10097 $this->addOption('LIMIT', $limit +1);
@@ -225,7 +222,9 @@
226223 ),
227224 'end' => array(
228225 ApiBase :: PARAM_TYPE => 'timestamp'
229 - )
 226+ ),
 227+ 'startsortkey' => null,
 228+ 'endsortkey' => null,
230229 );
231230 }
232231
@@ -238,6 +237,8 @@
239238 'dir' => 'In which direction to sort',
240239 'start' => 'Timestamp to start listing from. Can only be used with cmsort=timestamp',
241240 'end' => 'Timestamp to end listing at. Can only be used with cmsort=timestamp',
 241+ 'startsortkey' => 'Sortkey to start listing from. Can only be used with cmsort=sortkey',
 242+ 'endsortkey' => 'Sortkey to end listing at. Can only be used with cmsort=sortkey',
242243 'continue' => 'For large categories, give the value retured from previous query',
243244 'limit' => 'The maximum number of pages to return.',
244245 );
Index: trunk/phase3/RELEASE-NOTES
@@ -339,6 +339,8 @@
340340 and patrolmarks right
341341 * (bug 15985) acfrom and aifrom parameters didn't work when sorting in
342342 descending order.
 343+* (bug 15995) Add cmstartsortkey and cmendsortkey parameters to
 344+ list=categorymembers
343345
344346 === Languages updated in 1.14 ===
345347

Status & tagging log