r104083 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104082‎ | r104083 | r104084 >
Date:20:37, 23 November 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Fix hook copy paste fail

Move rest of captcha params out of api/ApiEditPage.php
Modified paths:
  • /trunk/extensions/ConfirmEdit/Captcha.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ConfirmEdit.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -239,13 +239,6 @@
240240 $ep->setContextTitle( $titleObj );
241241 $ep->importFormData( $req );
242242
243 - if ( isset( $params['captchaid'] ) && !is_null( $params['captchaid'] ) ) {
244 - $wgRequest->setVal( 'wpCaptchaId', $params['captchaid'] );
245 - }
246 - if ( isset( $params['captchaword'] ) && !is_null( $params['captchaword'] ) ) {
247 - $wgRequest->setVal( 'wpCaptchaWord', $params['captchaword'] );
248 - }
249 -
250243 // Run hooks
251244 // Handle APIEditBeforeSave parameters
252245 $r = array();
Index: trunk/extensions/ConfirmEdit/Captcha.php
@@ -428,6 +428,13 @@
429429 * @return bool false if the CAPTCHA is rejected, true otherwise
430430 */
431431 private function doConfirmEdit( $editPage, $newtext, $section, $merged = false ) {
 432+ global $wgRequest;
 433+ if ( $wgRequest->getVal( 'captchaid' ) ) {
 434+ $wgRequest->setVal( 'wpCaptchaId', $wgRequest->getVal( 'captchaid' ) );
 435+ }
 436+ if ( $wgRequest->getVal( 'captchaword' ) ) {
 437+ $wgRequest->setVal( 'wpCaptchaWord', $wgRequest->getVal( 'captchaword' ) );
 438+ }
432439 if ( $this->shouldCheck( $editPage, $newtext, $section, $merged ) ) {
433440 return $this->passCaptcha();
434441 } else {
Index: trunk/extensions/ConfirmEdit/ConfirmEdit.php
@@ -196,7 +196,7 @@
197197 # Register API hook
198198 $wgHooks['APIEditBeforeSave'][] = 'ConfirmEditHooks::confirmEditAPI';
199199 $wgHooks['APIGetAllowedParams'][] = 'ConfirmEditHooks::APIGetAllowedParams';
200 -$wgHooks['APIEditBeforeSave'][] = 'ConfirmEditHooks::APIEditBeforeSave';
 200+$wgHooks['APIGetParamDescription'][] = 'ConfirmEditHooks::APIGetParamDescription';
201201
202202 $wgAutoloadClasses['ConfirmEditHooks'] = "$wgConfirmEditIP/ConfirmEditHooks.php";
203203 $wgAutoloadClasses['SimpleCaptcha']= "$wgConfirmEditIP/Captcha.php";

Follow-up revisions

RevisionCommit summaryAuthorDate
r104467Followup r104064, r104083 for bug 32609...reedy18:55, 28 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104064* (bug 32609) API: Move captchaid/captchaword of action=edit from core to Cap...reedy19:09, 23 November 2011
r104066MW_SUPPORTS_EDITFILTERMERGED has been in since r27416...reedy19:18, 23 November 2011

Comments

#Comment by Duplicatebug (talk | contribs)   09:35, 24 November 2011

Follow up r104064

I would add it to confirmEditAPI, because it is only for the api, but that is marginal.

Status & tagging log