diff options
Diffstat (limited to 'includes/api/ApiQueryAllUsers.php')
-rw-r--r-- | includes/api/ApiQueryAllUsers.php | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 8395808b..5f9ff064 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 @@ -124,7 +127,16 @@ class ApiQueryAllUsers extends ApiQueryBase { if (!$row || $lastUser !== $row->user_name) { // Save the last pass's user data if (is_array($lastUserData)) - $data[] = $lastUserData; + { + $fit = $result->addValue(array('query', $this->getModuleName()), + null, $lastUserData); + if(!$fit) + { + $this->setContinueEnumParameter('from', + $this->keyToTitle($lastUserData['name'])); + break; + } + } // No more rows left if (!$row) @@ -166,8 +178,7 @@ class ApiQueryAllUsers extends ApiQueryBase { $db->freeResult($res); - $result->setIndexedTagName($data, 'u'); - $result->addValue('query', $this->getModuleName(), $data); + $result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'u'); } public function getAllowedParams() { @@ -192,7 +203,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 +217,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', ); } @@ -219,6 +232,6 @@ class ApiQueryAllUsers extends ApiQueryBase { } public function getVersion() { - return __CLASS__ . ': $Id: ApiQueryAllUsers.php 44472 2008-12-11 21:51:01Z catrope $'; + return __CLASS__ . ': $Id: ApiQueryAllUsers.php 46845 2009-02-05 14:30:59Z catrope $'; } -} +}
\ No newline at end of file |