X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiCreateAccount.php;h=b6c6210d7c44fb3f340777421ea689798c50ed32;hb=2cee7ebc042e81c857fe4b38c565b11fddb88529;hp=628f48ec19a56443a389ca6f749aecb5b59b6f02;hpb=0bb1a0a471f73d1caa2bb7e393821741b34a8aa5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiCreateAccount.php b/includes/api/ApiCreateAccount.php index 628f48ec19..b6c6210d7c 100644 --- a/includes/api/ApiCreateAccount.php +++ b/includes/api/ApiCreateAccount.php @@ -89,8 +89,16 @@ class ApiCreateAccount extends ApiBase { // Save settings (including confirmation token) $user->saveSettings(); - wfRunHooks( 'AddNewAccount', array( $user, false ) ); - $user->addNewUserLogEntry( $this->getUser()->isAnon(), $params['reason'] ); + wfRunHooks( 'AddNewAccount', array( $user, $params['mailpassword'] ) ); + + if ( $params['mailpassword'] ) { + $logAction = 'byemail'; + } elseif ( $this->getUser()->isLoggedIn() ) { + $logAction = 'create2'; + } else { + $logAction = 'create'; + } + $user->addNewUserLogEntry( $logAction, (string)$params['reason'] ); // Add username, id, and token to result. $result['username'] = $user->getName(); @@ -181,15 +189,15 @@ class ApiCreateAccount extends ApiBase { public function getParamDescription() { $p = $this->getModulePrefix(); return array( - 'name' => 'User Name', + 'name' => 'Username', 'password' => "Password (ignored if {$p}mailpassword is set)", - 'domain' => 'Domain (optional)', + 'domain' => 'Domain for external authentication (optional)', 'token' => 'Account creation token obtained in first request', - 'email' => 'Email address of user', - 'realname' => 'Real Name of user', - 'mailpassword' => 'Whether to generate and mail a random password to the user', - 'reason' => "Optional reason for creating the account (used when {$p}mailpassword is set)", - 'language' => 'Language code to set for the user.' + 'email' => 'E-mail address of user (optional)', + 'realname' => 'Real name of user (optional)', + 'mailpassword' => 'If set to any value, a random password will be e-mailed to the user', + 'reason' => 'Optional reason for creating the account to be put in the logs', + 'language' => 'Language code to set as default for the user (optional, defaults to content language)' ); } @@ -256,10 +264,6 @@ class ApiCreateAccount extends ApiBase { } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Account creation'; - } - - public function getVersion() { - return __CLASS__ . ': $Id$'; + return 'https://www.mediawiki.org/wiki/API:Account_creation'; } }