From: Sam Reed Date: Wed, 23 Nov 2011 19:09:57 +0000 (+0000) Subject: * (bug 32609) API: Move captchaid/captchaword of action=edit from core to Captcha... X-Git-Tag: 1.31.0-rc.0~26319 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=93fd7aceb8a334f863bb66baef8c0c3f41cc92bd;p=lhc%2Fweb%2Fwiklou.git * (bug 32609) API: Move captchaid/captchaword of action=edit from core to Captcha extension(s) Left setting of wpCaptchaId and wpCaptchaWord in core. Can't think of a sane way to check and set them via an extension (subclass and override, or a hook). Annoyingly APIEditBeforeSave doesn't pass the params array --- diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index ad2d529045..1b958152b8 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -176,6 +176,8 @@ production. * wlexcludeuser parameter added to ApiFeedWatchlist. * (bug 7304) Links on redirect pages no longer cause the redirect page to show up as a redirect to the linked page on Special:Whatlinkshere. +* (bug 32609) API: Move captchaid/captchaword of action=edit from core + to Captcha extension(s) === Languages updated in 1.19 === diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 7ae93706a4..aeed7e63f7 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -239,15 +239,15 @@ class ApiEditPage extends ApiBase { $ep->setContextTitle( $titleObj ); $ep->importFormData( $req ); - // Run hooks - // Handle CAPTCHA parameters - if ( !is_null( $params['captchaid'] ) ) { + if ( isset( $params['captchaid'] ) && !is_null( $params['captchaid'] ) ) { $wgRequest->setVal( 'wpCaptchaId', $params['captchaid'] ); } - if ( !is_null( $params['captchaword'] ) ) { + if ( isset( $params['captchaword'] ) && !is_null( $params['captchaword'] ) ) { $wgRequest->setVal( 'wpCaptchaWord', $params['captchaword'] ); } + // Run hooks + // Handle APIEditBeforeSave parameters $r = array(); if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) ) { if ( count( $r ) ) { @@ -422,8 +422,6 @@ class ApiEditPage extends ApiBase { 'recreate' => false, 'createonly' => false, 'nocreate' => false, - 'captchaword' => null, - 'captchaid' => null, 'watch' => array( ApiBase::PARAM_DFLT => false, ApiBase::PARAM_DEPRECATED => true, @@ -482,8 +480,6 @@ class ApiEditPage extends ApiBase { 'watch' => 'Add the page to your watchlist', 'unwatch' => 'Remove the page from your watchlist', 'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch', - 'captchaid' => 'CAPTCHA ID from previous request', - 'captchaword' => 'Answer to the CAPTCHA', 'md5' => array( "The MD5 hash of the {$p}text parameter, or the {$p}prependtext and {$p}appendtext parameters concatenated.", 'If set, the edit won\'t be done unless the hash is correct' ), 'prependtext' => "Add this text to the beginning of the page. Overrides {$p}text",