* (bug 32609) API: Move captchaid/captchaword of action=edit from core to Captcha...
authorSam Reed <reedy@users.mediawiki.org>
Wed, 23 Nov 2011 19:09:57 +0000 (19:09 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Wed, 23 Nov 2011 19:09:57 +0000 (19:09 +0000)
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

RELEASE-NOTES-1.19
includes/api/ApiEditPage.php

index ad2d529..1b95815 100644 (file)
@@ -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 ===
 
index 7ae9370..aeed7e6 100644 (file)
@@ -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",