Index: trunk/extensions/ConfirmEdit/FancyCaptcha.php |
— | — | @@ -38,5 +38,13 @@ |
39 | 39 | global $wgCaptchaSecret; |
40 | 40 | $wgCaptchaSecret = "CHANGE_THIS_SECRET!"; |
41 | 41 | |
| 42 | +/** |
| 43 | + * By default the FancyCaptcha rotates among all available captchas. |
| 44 | + * Setting $wgCaptchaDeleteOnSolve to true will delete the captcha |
| 45 | + * files when they are correctly solved. Thus the user will need |
| 46 | + * something like a cron creating new thumbnails to avoid drying up. |
| 47 | + */ |
| 48 | +$wgCaptchaDeleteOnSolve = false; |
| 49 | + |
42 | 50 | $wgExtensionMessagesFiles['FancyCaptcha'] = dirname( __FILE__ ) . '/FancyCaptcha.i18n.php'; |
43 | 51 | $wgAutoloadClasses['FancyCaptcha'] = dirname( __FILE__ ) . '/FancyCaptcha.class.php'; |
Index: trunk/extensions/ConfirmEdit/FancyCaptcha.class.php |
— | — | @@ -227,4 +227,23 @@ |
228 | 228 | # the default for edits |
229 | 229 | return wfEmptyMsg( $name, $text ) ? wfMsg( 'fancycaptcha-edit' ) : $text; |
230 | 230 | } |
| 231 | + |
| 232 | + /** |
| 233 | + * Delete a solved captcha image, if $wgCaptchaDeleteOnSolve is true. |
| 234 | + */ |
| 235 | + function passCaptcha() { |
| 236 | + global $wgCaptchaDeleteOnSolve; |
| 237 | + |
| 238 | + $info = $this->retrieveCaptcha(); // get the captcha info before it gets deleted |
| 239 | + $pass = parent::passCaptcha(); |
| 240 | + |
| 241 | + if ( $pass && $wgCaptchaDeleteOnSolve ) { |
| 242 | + $filename = $this->imagePath( $info['salt'], $info['hash'] ); |
| 243 | + if ( file_exists( $filename ) ) { |
| 244 | + unlink( $filename ); |
| 245 | + } |
| 246 | + } |
| 247 | + |
| 248 | + return $pass; |
| 249 | + } |
231 | 250 | } |