r25474 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25473‎ | r25474 | r25475 >
Date:14:30, 4 September 2007
Author:catrope
Status:old
Tags:
Comment:
Additional fix of bug 10890
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryCategoryMembers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php
@@ -74,13 +74,22 @@
7575
7676 $this->addFieldsIf('cl_timestamp', $fld_timestamp);
7777 $this->addTables(array('page','categorylinks')); // must be in this order for 'USE INDEX'
78 - $this->addOption('USE INDEX', 'cl_sortkey'); // Not needed after bug 10280 is applied to servers
 78+ // Not needed after bug 10280 is applied to servers
 79+ if($params['sort'] == 'timestamp')
 80+ {
 81+ $this->addOption('USE INDEX', 'cl_timestamp');
 82+ $this->addOption('ORDER BY', 'cl_to, cl_timestamp');
 83+ }
 84+ else
 85+ {
 86+ $this->addOption('USE INDEX', 'cl_sortkey');
 87+ $this->addOption('ORDER BY', 'cl_to, cl_sortkey, cl_from');
 88+ }
7989
8090 $this->addWhere('cl_from=page_id');
8191 $this->setContinuation($params['continue']);
8292 $this->addWhereFld('cl_to', $categoryTitle->getDBkey());
8393 $this->addWhereFld('page_namespace', $params['namespace']);
84 - $this->addOption('ORDER BY', "cl_to, cl_sortkey, cl_from");
8594
8695 $limit = $params['limit'];
8796 $this->addOption('LIMIT', $limit +1);
@@ -188,6 +197,13 @@
189198 ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1,
190199 ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2
191200 ),
 201+ 'sort' => array(
 202+ ApiBase :: PARAM_DFLT => 'sortkey',
 203+ ApiBase :: PARAM_TYPE => array(
 204+ 'sortkey',
 205+ 'timestamp'
 206+ )
 207+ )
192208 );
193209 }
194210
@@ -196,6 +212,7 @@
197213 'category' => 'Which category to enumerate (required)',
198214 'prop' => 'What pieces of information to include',
199215 'namespace' => 'Only include pages in these namespaces',
 216+ 'sort' => 'Property to sort by',
200217 'continue' => 'For large categories, give the value retured from previous query',
201218 'limit' => 'The maximum number of pages to return.',
202219 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r25530Merged revisions 25454-25529 via svnmerge from...david08:28, 5 September 2007

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r25459* (bug 10890) API: Timestamp support for categorymembers query...catrope20:37, 3 September 2007

Status & tagging log