summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryAllUsers.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiQueryAllUsers.php')
-rw-r--r--includes/api/ApiQueryAllUsers.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php
index 7f50cbad..7283aa00 100644
--- a/includes/api/ApiQueryAllUsers.php
+++ b/includes/api/ApiQueryAllUsers.php
@@ -37,7 +37,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
/**
* This function converts the user name to a canonical form
* which is stored in the database.
- * @param String $name
+ * @param string $name
* @return String
*/
private function getCanonicalUserName( $name ) {
@@ -81,12 +81,18 @@ class ApiQueryAllUsers extends ApiQueryBase {
$db->buildLike( $this->getCanonicalUserName( $params['prefix'] ), $db->anyString() ) );
}
- if ( !is_null( $params['rights'] ) ) {
+ if ( !is_null( $params['rights'] ) && count( $params['rights'] ) ) {
$groups = array();
foreach( $params['rights'] as $r ) {
$groups = array_merge( $groups, User::getGroupsWithPermission( $r ) );
}
+ // no group with the given right(s) exists, no need for a query
+ if( !count( $groups ) ) {
+ $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), '' );
+ return;
+ }
+
$groups = array_unique( $groups );
if ( is_null( $params['group'] ) ) {
@@ -155,7 +161,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
$this->addFields( array( 'recentedits' => 'COUNT(*)' ) );
$this->addWhere( 'rc_log_type IS NULL OR rc_log_type != ' . $db->addQuotes( 'newusers' ) );
- $timestamp = $db->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 );
+ $timestamp = $db->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays * 24 * 3600 );
$this->addWhere( 'rc_timestamp >= ' . $db->addQuotes( $timestamp ) );
$this->addOption( 'GROUP BY', $userFieldToSort );
@@ -273,7 +279,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
if ( $fld_rights ) {
if ( !isset( $lastUserData['rights'] ) ) {
if ( $lastUserObj ) {
- $lastUserData['rights'] = User::getGroupPermissions( $lastUserObj->getAutomaticGroups() );
+ $lastUserData['rights'] = User::getGroupPermissions( $lastUserObj->getAutomaticGroups() );
} else {
// This should not normally happen
$lastUserData['rights'] = array();
@@ -438,8 +444,4 @@ class ApiQueryAllUsers extends ApiQueryBase {
public function getHelpUrls() {
return 'https://www.mediawiki.org/wiki/API:Allusers';
}
-
- public function getVersion() {
- return __CLASS__ . ': $Id$';
- }
}