Index: trunk/extensions/ConfirmEdit/Captcha.php |
— | — | @@ -218,20 +218,6 @@ |
219 | 219 | |
220 | 220 | class SimpleCaptcha { |
221 | 221 | |
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 | | - |
236 | 222 | function getCaptcha() { |
237 | 223 | $a = mt_rand( 0, 100 ); |
238 | 224 | $b = mt_rand( 0, 10 ); |
— | — | @@ -835,7 +821,7 @@ |
836 | 822 | // Assign random index if we're not udpating |
837 | 823 | $info['index'] = strval( mt_rand() ); |
838 | 824 | } |
839 | | - $this->storage->store( $info['index'], $info ); |
| 825 | + CaptchaStore::get()->store( $info['index'], $info ); |
840 | 826 | return $info['index']; |
841 | 827 | } |
842 | 828 | |
— | — | @@ -846,7 +832,7 @@ |
847 | 833 | function retrieveCaptcha() { |
848 | 834 | global $wgRequest; |
849 | 835 | $index = $wgRequest->getVal( 'wpCaptchaId' ); |
850 | | - return $this->storage->retrieve( $index ); |
| 836 | + return CaptchaStore::get()->retrieve( $index ); |
851 | 837 | } |
852 | 838 | |
853 | 839 | /** |
— | — | @@ -854,7 +840,7 @@ |
855 | 841 | * it can't be reused. |
856 | 842 | */ |
857 | 843 | function clearCaptcha( $info ) { |
858 | | - $this->storage->clear( $info['index'] ); |
| 844 | + CaptchaStore::get()->clear( $info['index'] ); |
859 | 845 | } |
860 | 846 | |
861 | 847 | /** |
— | — | @@ -901,7 +887,7 @@ |
902 | 888 | global $wgOut; |
903 | 889 | $wgOut->setPageTitle( wfMsg( 'captchahelp-title' ) ); |
904 | 890 | $wgOut->addWikiText( wfMsg( 'captchahelp-text' ) ); |
905 | | - if ( $this->storage->cookiesNeeded() ) { |
| 891 | + if ( CaptchaStore::get()->cookiesNeeded() ) { |
906 | 892 | $wgOut->addWikiText( wfMsg( 'captchahelp-cookies-needed' ) ); |
907 | 893 | } |
908 | 894 | } |