diff options
author | Sam Reed <reedy@users.mediawiki.org> | 2012-02-16 20:13:35 +0000 |
---|---|---|
committer | Sam Reed <reedy@users.mediawiki.org> | 2012-02-16 20:13:35 +0000 |
commit | 107489687afa1b3cc6159233f2072df3a99927d3 (patch) | |
tree | 17e3361f91b3e85e0b7fbd52d12288c2c2feb4d5 /includes | |
parent | 736b978ede727b95cb76572ce9e61fd24ed16e95 (diff) | |
download | mediawikicore-107489687afa1b3cc6159233f2072df3a99927d3.tar.gz mediawikicore-107489687afa1b3cc6159233f2072df3a99927d3.zip |
Merge r111667 into trunk
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/111673
Diffstat (limited to 'includes')
-rw-r--r-- | includes/api/ApiQueryAllUsers.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 05fda5b50af3..ac112ef98221 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -60,10 +60,15 @@ class ApiQueryAllUsers extends ApiQueryBase { $from = is_null( $params['from'] ) ? null : $this->keyToTitle( $params['from'] ); $to = is_null( $params['to'] ) ? null : $this->keyToTitle( $params['to'] ); - $this->addWhereRange( 'user_name', $dir, $from, $to ); + # MySQL doesn't seem to use 'equality propagation' here, so like the + # ActiveUsers special page, we have to use rc_user_text for some cases. + $userFieldToSort = $params['activeusers'] ? 'rc_user_text' : 'user_name'; + + $this->addWhereRange( $userFieldToSort, $dir, $from, $to ); if ( !is_null( $params['prefix'] ) ) { - $this->addWhere( 'user_name' . $db->buildLike( $this->keyToTitle( $params['prefix'] ), $db->anyString() ) ); + $this->addWhere( $userFieldToSort . + $db->buildLike( $this->keyToTitle( $params['prefix'] ), $db->anyString() ) ); } if ( !is_null( $params['rights'] ) ) { @@ -143,7 +148,7 @@ class ApiQueryAllUsers extends ApiQueryBase { $timestamp = $db->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 ); $this->addWhere( "rc_timestamp >= {$db->addQuotes( $timestamp )}" ); - $this->addOption( 'GROUP BY', 'user_name' ); + $this->addOption( 'GROUP BY', $userFieldToSort ); } $this->addOption( 'LIMIT', $sqlLimit ); |