http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71884
Revision: 71884 Author: platonides Date: 2010-08-29 13:31:31 +0000 (Sun, 29 Aug 2010) Log Message: ----------- (Bug 24730) - add a "delete on success" option. Patch by [email protected] I just added some spaces and added the FancyCaptcha.php definition. Modified Paths: -------------- trunk/extensions/ConfirmEdit/FancyCaptcha.class.php trunk/extensions/ConfirmEdit/FancyCaptcha.php Modified: trunk/extensions/ConfirmEdit/FancyCaptcha.class.php =================================================================== --- trunk/extensions/ConfirmEdit/FancyCaptcha.class.php 2010-08-29 13:06:22 UTC (rev 71883) +++ trunk/extensions/ConfirmEdit/FancyCaptcha.class.php 2010-08-29 13:31:31 UTC (rev 71884) @@ -227,4 +227,23 @@ # the default for edits return wfEmptyMsg( $name, $text ) ? wfMsg( 'fancycaptcha-edit' ) : $text; } + + /** + * Delete a solved captcha image, if $wgCaptchaDeleteOnSolve is true. + */ + function passCaptcha() { + global $wgCaptchaDeleteOnSolve; + + $info = $this->retrieveCaptcha(); // get the captcha info before it gets deleted + $pass = parent::passCaptcha(); + + if ( $pass && $wgCaptchaDeleteOnSolve ) { + $filename = $this->imagePath( $info['salt'], $info['hash'] ); + if ( file_exists( $filename ) ) { + unlink( $filename ); + } + } + + return $pass; + } } Modified: trunk/extensions/ConfirmEdit/FancyCaptcha.php =================================================================== --- trunk/extensions/ConfirmEdit/FancyCaptcha.php 2010-08-29 13:06:22 UTC (rev 71883) +++ trunk/extensions/ConfirmEdit/FancyCaptcha.php 2010-08-29 13:31:31 UTC (rev 71884) @@ -38,5 +38,13 @@ global $wgCaptchaSecret; $wgCaptchaSecret = "CHANGE_THIS_SECRET!"; +/** + * By default the FancyCaptcha rotates among all available captchas. + * Setting $wgCaptchaDeleteOnSolve to true will delete the captcha + * files when they are correctly solved. Thus the user will need + * something like a cron creating new thumbnails to avoid drying up. + */ +$wgCaptchaDeleteOnSolve = false; + $wgExtensionMessagesFiles['FancyCaptcha'] = dirname( __FILE__ ) . '/FancyCaptcha.i18n.php'; $wgAutoloadClasses['FancyCaptcha'] = dirname( __FILE__ ) . '/FancyCaptcha.class.php'; _______________________________________________ MediaWiki-CVS mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
