- $data[$u] = [ 'name' => $u ];
- $urPage = new UserrightsPage;
- $urPage->setContext( $context );
- $iwUser = $urPage->fetchUser( $u );
-
- if ( $iwUser instanceof UserRightsProxy ) {
- $data[$u]['interwiki'] = true;
-
- if ( !is_null( $params['token'] ) ) {
- $tokenFunctions = $this->getTokenFunctions();
-
- foreach ( $params['token'] as $t ) {
- $val = call_user_func( $tokenFunctions[$t], $iwUser );
- if ( $val === false ) {
- $this->addWarning( [ 'apiwarn-tokennotallowed', $t ] );
- } else {
- $data[$u][$t . 'token'] = $val;
+ if ( $useNames ) {
+ $data[$u] = [ 'name' => $u ];
+ $urPage = new UserrightsPage;
+ $urPage->setContext( $context );
+
+ $iwUser = $urPage->fetchUser( $u );
+
+ if ( $iwUser instanceof UserRightsProxy ) {
+ $data[$u]['interwiki'] = true;
+
+ if ( !is_null( $params['token'] ) ) {
+ $tokenFunctions = $this->getTokenFunctions();
+
+ foreach ( $params['token'] as $t ) {
+ $val = call_user_func( $tokenFunctions[$t], $iwUser );
+ if ( $val === false ) {
+ $this->addWarning( [ 'apiwarn-tokennotallowed', $t ] );
+ } else {
+ $data[$u][$t . 'token'] = $val;
+ }