Merge "Removed old HTMLCacheUpdateJob b/c code"
[lhc/web/wiklou.git] / includes / api / ApiCreateAccount.php
index cfb6dab..b56a244 100644 (file)
  */
 class ApiCreateAccount extends ApiBase {
        public function execute() {
-               // If we're in JSON callback mode, no tokens can be obtained
-               if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
-                       $this->dieUsage( 'Cannot create account when using a callback', 'aborted' );
+               // If we're in a mode that breaks the same-origin policy, no tokens can
+               // be obtained
+               if ( $this->lacksSameOriginSecurity() ) {
+                       $this->dieUsage(
+                               'Cannot create account when the same-origin policy is not applied', 'aborted'
+                       );
                }
 
                // $loginForm->addNewaccountInternal will throw exceptions
@@ -83,7 +86,7 @@ class ApiCreateAccount extends ApiBase {
 
                $loginForm = new LoginForm();
                $loginForm->setContext( $context );
-               wfRunHooks( 'AddNewAccountApiForm', array( $this, $loginForm ) );
+               Hooks::run( 'AddNewAccountApiForm', array( $this, $loginForm ) );
                $loginForm->load();
 
                $status = $loginForm->addNewaccountInternal();
@@ -113,7 +116,7 @@ class ApiCreateAccount extends ApiBase {
                        // Save settings (including confirmation token)
                        $user->saveSettings();
 
-                       wfRunHooks( 'AddNewAccount', array( $user, $params['mailpassword'] ) );
+                       Hooks::run( 'AddNewAccount', array( $user, $params['mailpassword'] ) );
 
                        if ( $params['mailpassword'] ) {
                                $logAction = 'byemail';
@@ -160,7 +163,7 @@ class ApiCreateAccount extends ApiBase {
                }
 
                // Give extensions a chance to modify the API result data
-               wfRunHooks( 'AddNewAccountApiResult', array( $this, $loginForm, &$result ) );
+               Hooks::run( 'AddNewAccountApiResult', array( $this, $loginForm, &$result ) );
 
                $apiResult->addValue( null, 'createaccount', $result );
        }
@@ -200,7 +203,7 @@ class ApiCreateAccount extends ApiBase {
                );
        }
 
-       public function getExamplesMessages() {
+       protected function getExamplesMessages() {
                return array(
                        'action=createaccount&name=testuser&password=test123'
                                => 'apihelp-createaccount-example-pass',