Last modified: 2010-08-30 02:11:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 24730 - add a "delete on success" option.
add a "delete on success" option.
Product: MediaWiki extensions
Classification: Unclassified
ConfirmEdit (CAPTCHA extension) (Other open bugs)
All All
: Normal enhancement (vote)
: ---
Assigned To: Platonides
: patch, patch-reviewed
Depends on:
  Show dependency treegraph
Reported: 2010-08-08 21:54 UTC by infinity0x
Modified: 2010-08-30 02:11 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

basic (and incomplete) implementation of requested feature (1008 bytes, patch)
2010-08-08 21:54 UTC, infinity0x
full implementation (768 bytes, patch)
2010-08-10 14:10 UTC, infinity0x

Description infinity0x 2010-08-08 21:54:04 UTC
Created attachment 7614 [details]
basic (and incomplete) implementation of requested feature

Please add a "delete on success" option to the FancyCaptcha component, to avoid using the same captcha twice. This makes it simpler for system admins to set up (e.g.) a cron job that re-generates captchas when necessary, because obsolete ones are automatically removed. 

An incomplete implementation is supplied; it only works if $wgCaptchaDirectoryLevels == 0.
Comment 1 Platonides 2010-08-08 21:56:51 UTC
The problem is, it sometimes needs to reread them:
"in at least some circumstances, Konqueror tries to reload the image even if you haven't navigated away from the page"

What you can do is to delete from a cron the used files based on the atime.
Comment 2 infinity0x 2010-08-08 21:59:12 UTC
hmm... has anyone submitted a bug to konqueror about this? that is more correctly a bug on their side.

also, currently there is no simple way to detect from outside mediawiki whether the access was a success or a failure. there is no point deleting captchas that have not yet been solved.
Comment 3 infinity0x 2010-08-08 22:02:55 UTC
actually, wait look my patch is fine - it only deletes the captcha after it has been *solved*, ie. after the konquerer user has viewed it, and typed in the correct answer.
Comment 4 Platonides 2010-08-08 22:12:23 UTC
On second thought, removing after it has being shown as you were doing looks ok. Although it would be better to do it by overriding clearCaptcha(), not passCaptcha().

> hmm... has anyone submitted a bug to konqueror about this? that is more
> correctly a bug on their side.
I don't know. Probably not. It was just a comment in the code.
Comment 5 Platonides 2010-08-08 22:15:58 UTC
I think the whole content of the conditional could be replaced by:

$filename = $this->imagePath( $info['salt'], $info['hash'] );
if ( is_file( $filename ) ) {
unlink( $filename );
Comment 6 infinity0x 2010-08-08 22:23:30 UTC
oh cool, i guess that solves the $wgC..DirectoryLevel > 0 issue :) (I didn't look too closely at the rest of the code, I just mashed that up in a few minutes.)

another thought is $wgC..DeleteOnSolve maybe a better config name than $wgC..DeleteOnSuccess
Comment 7 X! 2010-08-09 01:31:15 UTC
Adding patch and need-review keywords
Comment 8 infinity0x 2010-08-10 14:10:50 UTC
Created attachment 7616 [details]
full implementation

new patch incorporates suggested changes, except overriding clearCaptcha rather than passCaptcha. (not sure that is even a good idea, because it's called on both a fail and a pass, whereas this patch only affects the pass case.)
Comment 9 Platonides 2010-08-29 13:32:37 UTC
Committed in r71884.
Comment 10 p858snake 2010-08-30 02:11:43 UTC
Patch has been applied.

Note You need to log in before you can comment on or make changes to this bug.