From b677d0191df692953e5534d6a437a66f2486043d Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 4 Feb 2009 19:10:14 +0000 Subject: [PATCH] * API: (bug 17355) Added auwitheditsonly parameter to list=allusers * Use consistent code style --- RELEASE-NOTES | 1 + includes/api/ApiQueryAllUsers.php | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 09f618440e..65f3698f68 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -159,6 +159,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 17317) Added watch parameter to action=protect * (bug 17007) Added export and exportnowrap parameters to action=query * (bug 17326) BREAKING CHANGE: Changed output format for iiprop=metadata +* (bug 17355) Added auwitheditsonly parameter to list=allusers === Languages updated in 1.15 === diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 828318c535..aeb0e2d1c1 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -57,11 +57,11 @@ class ApiQueryAllUsers extends ApiQueryBase { $limit = $params['limit']; $this->addTables('user', 'u1'); - if( !is_null( $params['from'] ) ) - $this->addWhere( 'u1.user_name >= ' . $db->addQuotes( $this->keyToTitle( $params['from'] ) ) ); + if (!is_null($params['from'])) + $this->addWhere('u1.user_name >= ' . $db->addQuotes($this->keyToTitle($params['from']))); - if( isset( $params['prefix'] ) ) - $this->addWhere( 'u1.user_name LIKE "' . $db->escapeLike( $this->keyToTitle( $params['prefix'] ) ) . '%"' ); + if (!is_null($params['prefix'])) + $this->addWhere('u1.user_name LIKE "' . $db->escapeLike($this->keyToTitle( $params['prefix'])) . '%"'); if (!is_null($params['group'])) { // Filter only users that belong to a given group @@ -70,6 +70,9 @@ class ApiQueryAllUsers extends ApiQueryBase { $this->addWhereFld('ug1.ug_group', $params['group']); } + if ($params['witheditsonly']) + $this->addWhere('user_editcount > 0'); + if ($fld_groups) { // Show the groups the given users belong to // request more than needed to avoid not getting all rows that belong to one user @@ -192,7 +195,8 @@ class ApiQueryAllUsers extends ApiQueryBase { ApiBase :: PARAM_MIN => 1, ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1, ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2 - ) + ), + 'witheditsonly' => false, ); } @@ -205,6 +209,7 @@ class ApiQueryAllUsers extends ApiQueryBase { 'What pieces of information to include.', '`groups` property uses more server resources and may return fewer results than the limit.'), 'limit' => 'How many total user names to return.', + 'witheditsonly' => 'Only list users who have made edits', ); } -- 2.20.1