* API: (bug 17355) Added auwitheditsonly parameter to list=allusers
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 4 Feb 2009 19:10:14 +0000 (19:10 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 4 Feb 2009 19:10:14 +0000 (19:10 +0000)
* Use consistent code style

RELEASE-NOTES
includes/api/ApiQueryAllUsers.php

index 09f6184..65f3698 100644 (file)
@@ -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 ===
 
index 828318c..aeb0e2d 100644 (file)
@@ -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',
                );
        }