r111667 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111666‎ | r111667 | r111668 >
Date:19:50, 16 February 2012
Author:aaron
Status:ok
Tags:
Comment:
live hack for bug 34451
Modified paths:
  • /branches/wmf/1.18wmf1/includes/api/ApiQueryAllUsers.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/includes/api/ApiQueryAllUsers.php
@@ -65,10 +65,15 @@
6666 $from = is_null( $params['from'] ) ? null : $this->keyToTitle( $params['from'] );
6767 $to = is_null( $params['to'] ) ? null : $this->keyToTitle( $params['to'] );
6868
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';
7072
 73+ $this->addWhereRange( $userFieldToSort, $dir, $from, $to );
 74+
7175 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() ) );
7378 }
7479
7580 if ( !is_null( $params['rights'] ) ) {
@@ -148,7 +153,7 @@
149154 $timestamp = $db->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 );
150155 $this->addWhere( "rc_timestamp >= {$db->addQuotes( $timestamp )}" );
151156
152 - $this->addOption( 'GROUP BY', 'user_name' );
 157+ $this->addOption( 'GROUP BY', $userFieldToSort );
153158 }
154159
155160 $this->addOption( 'LIMIT', $sqlLimit );

Follow-up revisions

RevisionCommit summaryAuthorDate
r111673Merge r111667 into trunkreedy20:13, 16 February 2012

Status & tagging log