X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fapi%2FApiTokens.php;h=f7290af9cbe8c74a3434b0406e2146c20ba823e1;hb=5d318d830323cc69b046b75fafaaa19b78034e9d;hp=5e197db7ce3cab7a6b7bec5cd89d6987f6390fdf;hpb=6b9c23cf6d47c4c854fd95acdbb72fd577aae8f8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiTokens.php b/includes/api/ApiTokens.php index 5e197db7ce..f7290af9cb 100644 --- a/includes/api/ApiTokens.php +++ b/includes/api/ApiTokens.php @@ -25,11 +25,17 @@ */ /** + * @deprecated since 1.24 * @ingroup API */ class ApiTokens extends ApiBase { public function execute() { + $this->setWarning( + "action=tokens has been deprecated. Please use action=query&meta=tokens instead." + ); + $this->logFeatureUsage( "action=tokens" ); + $params = $this->extractRequestParams(); $res = array(); @@ -64,13 +70,17 @@ class ApiTokens extends ApiBase { foreach ( $names as $name ) { $types[$name] = array( 'ApiQueryInfo', 'get' . ucfirst( $name ) . 'Token' ); } - wfRunHooks( 'ApiTokensGetTokenTypes', array( &$types ) ); + Hooks::run( 'ApiTokensGetTokenTypes', array( &$types ) ); ksort( $types ); wfProfileOut( __METHOD__ ); return $types; } + public function isDeprecated() { + return true; + } + public function getAllowedParams() { return array( 'type' => array( @@ -81,30 +91,12 @@ class ApiTokens extends ApiBase { ); } - public function getResultProperties() { - $props = array( - '' => array(), - ); - - self::addTokenProperties( $props, $this->getTokenTypes() ); - - return $props; - } - - 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=tokens' => 'Retrieve an edit token (the default)', - 'api.php?action=tokens&type=email|move' => 'Retrieve an email token and a move token' + 'action=tokens' + => 'apihelp-tokens-example-edit', + 'action=tokens&type=email|move' + => 'apihelp-tokens-example-emailmove', ); } }