diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
commit | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch) | |
tree | f1fdd326034e05177596851be6a7127615d81498 /includes/api/ApiQueryTokens.php | |
parent | 9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff) | |
parent | f6d65e533c62f6deb21342d4901ece24497b433e (diff) |
Merge commit 'f6d65'
# Conflicts:
# skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'includes/api/ApiQueryTokens.php')
-rw-r--r-- | includes/api/ApiQueryTokens.php | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/includes/api/ApiQueryTokens.php b/includes/api/ApiQueryTokens.php index ba9c9377..65a08a3b 100644 --- a/includes/api/ApiQueryTokens.php +++ b/includes/api/ApiQueryTokens.php @@ -35,10 +35,12 @@ class ApiQueryTokens extends ApiQueryBase { public function execute() { $params = $this->extractRequestParams(); - $res = array(); + $res = array( + ApiResult::META_TYPE => 'assoc', + ); - if ( $this->getMain()->getRequest()->getVal( 'callback' ) !== null ) { - $this->setWarning( 'Tokens may not be obtained when using a callback' ); + if ( $this->lacksSameOriginSecurity() ) { + $this->setWarning( 'Tokens may not be obtained when the same-origin policy is not applied' ); return; } @@ -55,7 +57,6 @@ class ApiQueryTokens extends ApiQueryBase { public static function getTokenTypeSalts() { static $salts = null; if ( !$salts ) { - wfProfileIn( __METHOD__ ); $salts = array( 'csrf' => '', 'watch' => 'watch', @@ -63,9 +64,8 @@ class ApiQueryTokens extends ApiQueryBase { 'rollback' => 'rollback', 'userrights' => 'userrights', ); - wfRunHooks( 'ApiQueryTokensRegisterTypes', array( &$salts ) ); + Hooks::run( 'ApiQueryTokensRegisterTypes', array( &$salts ) ); ksort( $salts ); - wfProfileOut( __METHOD__ ); } return $salts; @@ -81,20 +81,12 @@ class ApiQueryTokens extends ApiQueryBase { ); } - public function getParamDescription() { - return array( - 'type' => 'Type of token(s) to request' - ); - } - - public function getDescription() { - return 'Gets tokens for data-modifying actions.'; - } - - protected function getExamples() { + protected function getExamplesMessages() { return array( - 'api.php?action=query&meta=tokens' => 'Retrieve a csrf token (the default)', - 'api.php?action=query&meta=tokens&type=watch|patrol' => 'Retrieve a watch token and a patrol token' + 'action=query&meta=tokens' + => 'apihelp-query+tokens-example-simple', + 'action=query&meta=tokens&type=watch|patrol' + => 'apihelp-query+tokens-example-types', ); } |