X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiTokens.php;h=ff1914c8704b3a3317844d8ecab2c59b96bb1822;hb=ae031e237eab8e2023d0fe128f9749a8a43ea439;hp=4940394fe824368f71e3d8390d969af880354c8f;hpb=47b93ded1388ce5712d0a816db4ddd3466609bcd;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiTokens.php b/includes/api/ApiTokens.php index 4940394fe8..ff1914c870 100644 --- a/includes/api/ApiTokens.php +++ b/includes/api/ApiTokens.php @@ -1,9 +1,5 @@ setWarning( - 'action=tokens has been deprecated. Please use action=query&meta=tokens instead.' + $this->addDeprecation( + [ 'apiwarn-deprecation-withreplacement', 'action=tokens', 'action=query&meta=tokens' ], + 'action=tokens' ); - $this->logFeatureUsage( 'action=tokens' ); $params = $this->extractRequestParams(); $res = [ @@ -46,7 +42,7 @@ class ApiTokens extends ApiBase { $val = call_user_func( $types[$type], null, null ); if ( $val === false ) { - $this->setWarning( "Action '$type' is not allowed for the current user" ); + $this->addWarning( [ 'apiwarn-tokennotallowed', $type ] ); } else { $res[$type . 'token'] = $val; } @@ -66,11 +62,11 @@ class ApiTokens extends ApiBase { if ( $types ) { return $types; } - $types = [ 'patrol' => [ 'ApiQueryRecentChanges', 'getPatrolToken' ] ]; + $types = [ 'patrol' => [ ApiQueryRecentChanges::class, 'getPatrolToken' ] ]; $names = [ 'edit', 'delete', 'protect', 'move', 'block', 'unblock', 'email', 'import', 'watch', 'options' ]; foreach ( $names as $name ) { - $types[$name] = [ 'ApiQueryInfo', 'get' . ucfirst( $name ) . 'Token' ]; + $types[$name] = [ ApiQueryInfo::class, 'get' . ucfirst( $name ) . 'Token' ]; } Hooks::run( 'ApiTokensGetTokenTypes', [ &$types ] );