Merge "API edit: allow ConfirmEdit to use the merged parse"
[lhc/web/wiklou.git] / includes / api / ApiCreateAccount.php
index 35bba17..89f8481 100644 (file)
@@ -165,10 +165,6 @@ class ApiCreateAccount extends ApiBase {
                $apiResult->addValue( null, 'createaccount', $result );
        }
 
-       public function getDescription() {
-               return 'Create a new user account.';
-       }
-
        public function mustBePosted() {
                return true;
        }
@@ -204,105 +200,12 @@ class ApiCreateAccount extends ApiBase {
                );
        }
 
-       public function getParamDescription() {
-               $p = $this->getModulePrefix();
-
-               return array(
-                       'name' => 'Username',
-                       'password' => "Password (ignored if {$p}mailpassword is set)",
-                       'domain' => 'Domain for external authentication (optional)',
-                       'token' => 'Account creation token obtained in first request',
-                       'email' => 'Email address of user (optional)',
-                       'realname' => 'Real name of user (optional)',
-                       'mailpassword' => 'If set to any value, a random password will be emailed 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)'
-               );
-       }
-
-       public function getResultProperties() {
-               return array(
-                       'createaccount' => array(
-                               'result' => array(
-                                       ApiBase::PROP_TYPE => array(
-                                               'Success',
-                                               'Warning',
-                                               'NeedToken'
-                                       )
-                               ),
-                               'username' => array(
-                                       ApiBase::PROP_TYPE => 'string',
-                                       ApiBase::PROP_NULLABLE => true
-                               ),
-                               'userid' => array(
-                                       ApiBase::PROP_TYPE => 'int',
-                                       ApiBase::PROP_NULLABLE => true
-                               ),
-                               'token' => array(
-                                       ApiBase::PROP_TYPE => 'string',
-                                       ApiBase::PROP_NULLABLE => true
-                               ),
-                       )
-               );
-       }
-
-       public function getPossibleErrors() {
-               // Note the following errors aren't possible and don't need to be listed:
-               // sessionfailure, nocookiesfornew, badretype
-               $localErrors = array(
-                       'wrongpassword', // Actually caused by wrong domain field. Riddle me that...
-                       'sorbs_create_account_reason',
-                       'noname',
-                       'userexists',
-                       'password-name-match', // from User::getPasswordValidity
-                       'password-login-forbidden', // from User::getPasswordValidity
-                       'noemailtitle',
-                       'invalidemailaddress',
-                       'externaldberror',
-                       'acct_creation_throttle_hit',
-               );
-
-               $errors = parent::getPossibleErrors();
-               // All local errors are from LoginForm, which means they're actually message keys.
-               foreach ( $localErrors as $error ) {
-                       $errors[] = array(
-                               'code' => $error,
-                               'info' => wfMessage( $error )->inLanguage( 'en' )->useDatabase( false )->parse()
-                       );
-               }
-
-               $errors[] = array(
-                       'code' => 'permdenied-createaccount',
-                       'info' => 'You do not have the right to create a new account'
-               );
-               $errors[] = array(
-                       'code' => 'blocked',
-                       'info' => 'You cannot create a new account because you are blocked'
-               );
-               $errors[] = array(
-                       'code' => 'aborted',
-                       'info' => 'Account creation aborted by hook (info may vary)'
-               );
-               $errors[] = array(
-                       'code' => 'langinvalid',
-                       'info' => 'Invalid language parameter'
-               );
-
-               // 'passwordtooshort' has parameters. :(
-               $errors[] = array(
-                       'code' => 'passwordtooshort',
-                       'info' => wfMessage( 'passwordtooshort', $this->getConfig()->get( 'MinimalPasswordLength' ) )
-                               ->inLanguage( 'en' )->useDatabase( false )->parse()
-               );
-
-               return $errors;
-       }
-
-       public function getExamples() {
+       protected function getExamplesMessages() {
                return array(
-                       'api.php?action=createaccount&name=testuser&password=test123',
-                       'api.php?action=createaccount&name=testmailuser&mailpassword=true&reason=MyReason',
+                       'action=createaccount&name=testuser&password=test123'
+                               => 'apihelp-createaccount-example-pass',
+                       'action=createaccount&name=testmailuser&mailpassword=true&reason=MyReason'
+                               => 'apihelp-createaccount-example-mail',
                );
        }