r86825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86824‎ | r86825 | r86826 >
Date:17:33, 24 April 2011
Author:happy-melon
Status:ok
Tags:
Comment:
File missing from r86820. Actually these changes should have been committed in r86813...
Modified paths:
  • /trunk/extensions/ConfirmEdit/Captcha.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmEdit/Captcha.php
@@ -218,20 +218,6 @@
219219
220220 class SimpleCaptcha {
221221
222 - /**
223 - * @var CaptchaStore
224 - */
225 - protected $storage;
226 -
227 - function __construct() {
228 - global $wgCaptchaStorageClass;
229 - if( in_array( 'CaptchaStore', class_implements( $wgCaptchaStorageClass ) ) ) {
230 - $this->storage = new $wgCaptchaStorageClass;
231 - } else {
232 - throw new MWException( "Invalid CaptchaStore class $wgCaptchaStorageClass" );
233 - }
234 - }
235 -
236222 function getCaptcha() {
237223 $a = mt_rand( 0, 100 );
238224 $b = mt_rand( 0, 10 );
@@ -835,7 +821,7 @@
836822 // Assign random index if we're not udpating
837823 $info['index'] = strval( mt_rand() );
838824 }
839 - $this->storage->store( $info['index'], $info );
 825+ CaptchaStore::get()->store( $info['index'], $info );
840826 return $info['index'];
841827 }
842828
@@ -846,7 +832,7 @@
847833 function retrieveCaptcha() {
848834 global $wgRequest;
849835 $index = $wgRequest->getVal( 'wpCaptchaId' );
850 - return $this->storage->retrieve( $index );
 836+ return CaptchaStore::get()->retrieve( $index );
851837 }
852838
853839 /**
@@ -854,7 +840,7 @@
855841 * it can't be reused.
856842 */
857843 function clearCaptcha( $info ) {
858 - $this->storage->clear( $info['index'] );
 844+ CaptchaStore::get()->clear( $info['index'] );
859845 }
860846
861847 /**
@@ -901,7 +887,7 @@
902888 global $wgOut;
903889 $wgOut->setPageTitle( wfMsg( 'captchahelp-title' ) );
904890 $wgOut->addWikiText( wfMsg( 'captchahelp-text' ) );
905 - if ( $this->storage->cookiesNeeded() ) {
 891+ if ( CaptchaStore::get()->cookiesNeeded() ) {
906892 $wgOut->addWikiText( wfMsg( 'captchahelp-cookies-needed' ) );
907893 }
908894 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86813Introduce a CaptchaStore abstract class that CaptchaSessionStore and CaptchaC...happy-melon11:41, 24 April 2011
r86820Follow-up r86813: fix exceptions seen on TWN. Ironically, I changed the Capt...happy-melon16:49, 24 April 2011

Status & tagging log