Remove pre-1.25 API compatibility code

Since this extension uses extension.json, it already requires 1.25+ so
no need to keep the old code around.

Change-Id: I31b96b0939d5321be31889422cfc703c9c6c2baa
This commit is contained in:
Brad Jorsch 2016-09-20 14:49:32 -04:00
parent 133c67b109
commit ac97e69999
6 changed files with 15 additions and 89 deletions

View file

@ -17,24 +17,10 @@ class ApiFancyCaptchaReload extends ApiBase {
return true;
}
/**
* @deprecated since MediaWiki core 1.25
*/
public function getDescription() {
return 'Get a new FancyCaptcha.';
}
public function getAllowedParams() {
return [];
}
/**
* @deprecated since MediaWiki core 1.25
*/
public function getExamples() {
return [ 'api.php?action=fancycaptchareload&format=xml' ];
}
/**
* @see ApiBase::getExamplesMessages()
*/

View file

@ -83,30 +83,12 @@ class ReCaptcha extends SimpleCaptcha {
public function APIGetAllowedParams( &$module, &$params, $flags ) {
if ( $flags && $this->isAPICaptchaModule( $module ) ) {
if ( defined( 'ApiBase::PARAM_HELP_MSG' ) ) {
$params['recaptcha_challenge_field'] = [
ApiBase::PARAM_HELP_MSG => 'recaptcha-apihelp-param-recaptcha_challenge_field',
];
$params['recaptcha_response_field'] = [
ApiBase::PARAM_HELP_MSG => 'recaptcha-apihelp-param-recaptcha_response_field',
];
} else {
// @todo: Remove this branch when support for MediaWiki < 1.25 is dropped
$params['recaptcha_challenge_field'] = null;
$params['recaptcha_response_field'] = null;
}
}
return true;
}
/**
* @deprecated since MediaWiki 1.25
*/
public function APIGetParamDescription( &$module, &$desc ) {
if ( $this->isAPICaptchaModule( $module ) ) {
$desc['recaptcha_challenge_field'] = 'Field from the ReCaptcha widget';
$desc['recaptcha_response_field'] = 'Field from the ReCaptcha widget';
$params['recaptcha_challenge_field'] = [
ApiBase::PARAM_HELP_MSG => 'recaptcha-apihelp-param-recaptcha_challenge_field',
];
$params['recaptcha_response_field'] = [
ApiBase::PARAM_HELP_MSG => 'recaptcha-apihelp-param-recaptcha_response_field',
];
}
return true;

View file

@ -154,25 +154,9 @@ HTML;
public function APIGetAllowedParams( &$module, &$params, $flags ) {
if ( $flags && $this->isAPICaptchaModule( $module ) ) {
if ( defined( 'ApiBase::PARAM_HELP_MSG' ) ) {
$params['g-recaptcha-response'] = [
ApiBase::PARAM_HELP_MSG => 'renocaptcha-apihelp-param-g-recaptcha-response',
];
} else {
// @todo: Remove this branch when support for MediaWiki < 1.25 is dropped
$params['g-recaptcha-response'] = null;
}
}
return true;
}
/**
* @deprecated since MediaWiki 1.25
*/
public function APIGetParamDescription( &$module, &$desc ) {
if ( $this->isAPICaptchaModule( $module ) ) {
$desc['g-recaptcha-response'] = 'Field from the ReCaptcha widget';
$params['g-recaptcha-response'] = [
ApiBase::PARAM_HELP_MSG => 'renocaptcha-apihelp-param-g-recaptcha-response',
];
}
return true;

View file

@ -1072,33 +1072,12 @@ class SimpleCaptcha {
*/
public function APIGetAllowedParams( &$module, &$params, $flags ) {
if ( $this->isAPICaptchaModule( $module ) ) {
if ( defined( 'ApiBase::PARAM_HELP_MSG' ) ) {
$params['captchaword'] = [
ApiBase::PARAM_HELP_MSG => 'captcha-apihelp-param-captchaword',
];
$params['captchaid'] = [
ApiBase::PARAM_HELP_MSG => 'captcha-apihelp-param-captchaid',
];
} else {
// @todo: Remove this branch when support for MediaWiki < 1.25 is dropped
$params['captchaword'] = null;
$params['captchaid'] = null;
}
}
return true;
}
/**
* @deprecated Since MediaWiki 1.25
* @param $module ApiBase
* @param $desc array
* @return bool
*/
public function APIGetParamDescription( &$module, &$desc ) {
if ( $this->isAPICaptchaModule( $module ) ) {
$desc['captchaid'] = 'CAPTCHA ID from previous request';
$desc['captchaword'] = 'Answer to the CAPTCHA';
$params['captchaword'] = [
ApiBase::PARAM_HELP_MSG => 'captcha-apihelp-param-captchaword',
];
$params['captchaid'] = [
ApiBase::PARAM_HELP_MSG => 'captcha-apihelp-param-captchaid',
];
}
return true;

View file

@ -76,7 +76,6 @@
"EditPage::showEditForm:fields": "ConfirmEditHooks::showEditFormFields",
"EditFilterMergedContent": "ConfirmEditHooks::confirmEditMerged",
"APIGetAllowedParams": "ConfirmEditHooks::APIGetAllowedParams",
"APIGetParamDescription": "ConfirmEditHooks::APIGetParamDescription",
"TitleReadWhitelist": "ConfirmEditHooks::onTitleReadWhitelist",
"AlternateEditPreview": "ConfirmEditHooks::onAlternateEditPreview"
},

View file

@ -128,10 +128,6 @@ class ConfirmEditHooks {
return self::getInstance()->APIGetAllowedParams( $module, $params, $flags );
}
public static function APIGetParamDescription( &$module, &$desc ) {
return self::getInstance()->APIGetParamDescription( $module, $desc );
}
public static function onAuthChangeFormFields(
array $requests, array $fieldInfo, array &$formDescriptor, $action
) {