From: Gergő Tisza Date: Mon, 30 May 2016 18:16:07 +0000 (+0200) Subject: Return error message in users API cancreate field X-Git-Tag: 1.31.0-rc.0~6756^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=43f4a05ec331bee0daf577de11bf56d0c1678bc8;p=lhc%2Fweb%2Fwiklou.git Return error message in users API cancreate field That API field exposes AuthManager::canCreateAccount, where the error message is important. Change-Id: Idef441b311b94ff0cb6c4deaed1ac93959ee7ee8 --- diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 68ec38dd9f..5afb66f225 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -262,8 +262,11 @@ class ApiQueryUsers extends ApiQueryBase { } else { $data[$u]['missing'] = true; if ( isset( $this->prop['cancreate'] ) && !$this->getConfig()->get( 'DisableAuthManager' ) ) { - $data[$u]['cancreate'] = MediaWiki\Auth\AuthManager::singleton()->canCreateAccount( $u ) - ->isGood(); + $status = MediaWiki\Auth\AuthManager::singleton()->canCreateAccount( $u ); + $data[$u]['cancreate'] = $status->isGood(); + if ( !$status->isGood() ) { + $data[$u]['cancreateerror'] = $this->getErrorFormatter()->arrayFromStatus( $status ); + } } } } else {