From: Catrope Date: Mon, 29 Oct 2012 19:44:18 +0000 (+0000) Subject: Merge "list=allusers&aurights=[unusedright] returns all users of the wiki" X-Git-Tag: 1.31.0-rc.0~21813 X-Git-Url: https://git.heureux-cyclage.org/w/index.php?a=commitdiff_plain;h=7cc9c4b52000f6df4512a22d889f5d17c55b9dd7;hp=770b6519bedcfdae9fe6debb22b349a61b84ab28;p=lhc%2Fweb%2Fwiklou.git Merge "list=allusers&aurights=[unusedright] returns all users of the wiki" --- diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 7f50cbad2e..79f6469442 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -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'] ) ) {