r83834 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83833‎ | r83834 | r83835 >
Date:17:23, 13 March 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 27342) Add audir param to list=allusers
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllUsers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllUsers.php
@@ -59,13 +59,12 @@
6060 $this->addTables( 'user' );
6161 $useIndex = true;
6262
63 - if ( !is_null( $params['from'] ) ) {
64 - $this->addWhere( 'user_name >= ' . $db->addQuotes( $this->keyToTitle( $params['from'] ) ) );
65 - }
66 - if ( !is_null( $params['to'] ) ) {
67 - $this->addWhere( 'user_name <= ' . $db->addQuotes( $this->keyToTitle( $params['to'] ) ) );
68 - }
 63+ $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
 64+ $from = is_null( $params['from'] ) ? null : $this->keyToTitle( $params['from'] );
 65+ $to = is_null( $params['to'] ) ? null : $this->keyToTitle( $params['to'] );
6966
 67+ $this->addWhereRange( 'user_name', $dir, $from, $to );
 68+
7069 if ( !is_null( $params['prefix'] ) ) {
7170 $this->addWhere( 'user_name' . $db->buildLike( $this->keyToTitle( $params['prefix'] ), $db->anyString() ) );
7271 }
@@ -123,7 +122,6 @@
124123 $this->addFieldsIf( 'user_editcount', $fld_editcount );
125124 $this->addFieldsIf( 'user_registration', $fld_registration );
126125
127 - $this->addOption( 'ORDER BY', 'user_name' );
128126 if ( $useIndex ) {
129127 $this->addOption( 'USE INDEX', array( 'user' => 'user_name' ) );
130128 }
@@ -239,6 +237,13 @@
240238 'from' => null,
241239 'to' => null,
242240 'prefix' => null,
 241+ 'dir' => array(
 242+ ApiBase::PARAM_DFLT => 'ascending',
 243+ ApiBase::PARAM_TYPE => array(
 244+ 'ascending',
 245+ 'descending'
 246+ ),
 247+ ),
243248 'group' => array(
244249 ApiBase::PARAM_TYPE => User::getAllGroups(),
245250 ApiBase::PARAM_ISMULTI => true,
@@ -273,6 +278,7 @@
274279 'from' => 'The user name to start enumerating from',
275280 'to' => 'The user name to stop enumerating at',
276281 'prefix' => 'Search for all users that begin with this value',
 282+ 'dir' => 'Direction to sort in',
277283 'group' => 'Limit users to given group name(s)',
278284 'rights' => 'Limit users to given right(s)',
279285 'prop' => array(
Index: trunk/phase3/RELEASE-NOTES
@@ -249,6 +249,7 @@
250250 * (bug 27182) API: Add filter by prefix for meta=allmessages
251251 * (bug 27183) API: Add filter by customisation state for meta=allmessages
252252 * (bug 27340) API: Allow listing of "small" categories
 253+* (bug 27342) Add audir param to list=allusers
253254
254255 === Languages updated in 1.18 ===
255256

Status & tagging log