X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiUsageException.php;h=17655ec1c3de27737db1fc322d51bd4e5095237e;hb=e7720b8f8e09287384ddee271641d1b1721318bb;hp=7e21ab5ba446c227135ae5e7fd9e2e16042bb1c9;hpb=b26ad1ac3f9477dcf7a04705b641d5e42fbec3a4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiUsageException.php b/includes/api/ApiUsageException.php index 7e21ab5ba4..17655ec1c3 100644 --- a/includes/api/ApiUsageException.php +++ b/includes/api/ApiUsageException.php @@ -45,6 +45,10 @@ class UsageException extends MWException { $this->mCodestr = $codestr; $this->mExtraData = $extradata; + if ( !$this instanceof ApiUsageException ) { + wfDeprecated( __METHOD__, '1.29' ); + } + // This should never happen, so throw an exception about it that will // hopefully get logged with a backtrace (T138585) if ( !is_string( $codestr ) || $codestr === '' ) { @@ -58,6 +62,7 @@ class UsageException extends MWException { * @return string */ public function getCodeString() { + wfDeprecated( __METHOD__, '1.29' ); return $this->mCodestr; } @@ -65,6 +70,7 @@ class UsageException extends MWException { * @return array */ public function getMessageArray() { + wfDeprecated( __METHOD__, '1.29' ); $result = [ 'code' => $this->mCodestr, 'info' => $this->getMessage() @@ -95,7 +101,7 @@ class UsageException extends MWException { * starts throwing ApiUsageException. Eventually UsageException will go away * and this will (probably) extend MWException directly. */ -class ApiUsageException extends UsageException { +class ApiUsageException extends UsageException implements ILocalizedException { protected $modulePath; protected $status; @@ -180,18 +186,20 @@ class ApiUsageException extends UsageException { /** * @deprecated Do not use. This only exists here because UsageException is in * the inheritance chain for backwards compatibility. - * @inheritdoc + * @inheritDoc */ public function getCodeString() { + wfDeprecated( __METHOD__, '1.29' ); return $this->getApiMessage()->getApiCode(); } /** * @deprecated Do not use. This only exists here because UsageException is in * the inheritance chain for backwards compatibility. - * @inheritdoc + * @inheritDoc */ public function getMessageArray() { + wfDeprecated( __METHOD__, '1.29' ); $enMsg = clone $this->getApiMessage(); $enMsg->inLanguage( 'en' )->useDatabase( false ); @@ -201,6 +209,13 @@ class ApiUsageException extends UsageException { ] + $enMsg->getApiData(); } + /** + * @inheritDoc + */ + public function getMessageObject() { + return $this->status->getMessage(); + } + /** * @return string */