Index: branches/wmf/1.18wmf1/includes/api/ApiQueryAllUsers.php |
— | — | @@ -65,10 +65,15 @@ |
66 | 66 | $from = is_null( $params['from'] ) ? null : $this->keyToTitle( $params['from'] ); |
67 | 67 | $to = is_null( $params['to'] ) ? null : $this->keyToTitle( $params['to'] ); |
68 | 68 | |
69 | | - $this->addWhereRange( 'user_name', $dir, $from, $to ); |
| 69 | + # MySQL doesn't seem to use 'equality propagation' here, so like the |
| 70 | + # ActiveUsers special page, we have to use rc_user_text for some cases. |
| 71 | + $userFieldToSort = $params['activeusers'] ? 'rc_user_text' : 'user_name'; |
70 | 72 | |
| 73 | + $this->addWhereRange( $userFieldToSort, $dir, $from, $to ); |
| 74 | + |
71 | 75 | if ( !is_null( $params['prefix'] ) ) { |
72 | | - $this->addWhere( 'user_name' . $db->buildLike( $this->keyToTitle( $params['prefix'] ), $db->anyString() ) ); |
| 76 | + $this->addWhere( $userFieldToSort . |
| 77 | + $db->buildLike( $this->keyToTitle( $params['prefix'] ), $db->anyString() ) ); |
73 | 78 | } |
74 | 79 | |
75 | 80 | if ( !is_null( $params['rights'] ) ) { |
— | — | @@ -148,7 +153,7 @@ |
149 | 154 | $timestamp = $db->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 ); |
150 | 155 | $this->addWhere( "rc_timestamp >= {$db->addQuotes( $timestamp )}" ); |
151 | 156 | |
152 | | - $this->addOption( 'GROUP BY', 'user_name' ); |
| 157 | + $this->addOption( 'GROUP BY', $userFieldToSort ); |
153 | 158 | } |
154 | 159 | |
155 | 160 | $this->addOption( 'LIMIT', $sqlLimit ); |