From 972a93bd6dd47f24676e6082a25d54450e824e88 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Fri, 17 Aug 2007 13:01:35 +0000 Subject: [PATCH] * (bug 10971) `aufrom` parameter doesn't work with spaces * Fix username handling issue with `auprefix` parameter Usernames are *not* stored in "key" format, and treating them as such will cause various comparisons to misbehave. This was preventing `aufrom` from including the username (as it was supposed to) and would have broken `auprefix` for all comparisons containing spaces. As a side-effect, both these parameters will now treat underscores as equivalent to spaces. --- RELEASE-NOTES | 3 +++ includes/api/ApiQueryAllUsers.php | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 681a8f2289..3ffb7f85bf 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -441,6 +441,9 @@ Full API documentation is available at http://www.mediawiki.org/wiki/API * Added site statistics (siprop=statistics for meta=siteinfo) * (bug 10902) Unable to fetch user contributions from IP addresses * `list=usercontribs` no longer requires that the user exist +* (bug 10971) `aufrom` parameter doesn't work with spaces +* Fix username handling issue with `auprefix` parameter +* Treat underscores as spaces for `aufrom` and `auprefix` parameters == Maintenance script changes since 1.10 == diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 837123c116..1a609837d1 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -55,11 +55,11 @@ class ApiQueryAllUsers extends ApiQueryBase { $limit = $params['limit']; $tables = $db->tableName('user'); - if (!is_null($params['from'])) - $this->addWhere('user_name>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from']))); - - if (isset($params['prefix'])) - $this->addWhere("user_name LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'"); + if( !is_null( $params['from'] ) ) + $this->addWhere( 'user_name >= ' . $db->addQuotes( self::keyToTitle( $params['from'] ) ) ); + + if( isset( $params['prefix'] ) ) + $this->addWhere( 'user_name LIKE "' . $db->escapeLike( self::keyToTitle( $params['prefix'] ) ) . '%"' ); if (!is_null($params['group'])) { // Filter only users that belong to a given group -- 2.20.1