When an invalid value is set in 'throttle_anonymous(_user)' once, the change of the value becomes impossible.
One method of the fix is as follows.
// $Id: throttle.module,v 1.68 2006/10/22 08:28:46 unconed Exp $
function throttle_admin_settings() {
if (isset($_POST['throttle_anonymous'])) {
variable_set('throttle_anonymous', $_POST['throttle_anonymous']);
}
if (isset($_POST['throttle_user'])) {
variable_set('throttle_user', $_POST['throttle_user']);
}
_throttle_validate(variable_get('throttle_anonymous', ''), 'throttle_anonymous');
_throttle_validate(variable_get('throttle_user', ''), 'throttle_user');
Comments
Comment #1
gregglesHow would I get an invalid value into that? How do I repeat this problem to be able to confirm it?
Comment #2
gregglesAnd in the future please provide actual patches, not just pasted code:
http://drupal.org/diffandpatch
Comment #3
chx commentedsoon to be won't fixed but i hold it for a little while.
Comment #4
Takafumi commented1. go to admin/settings/throttle
2. enter '-1' at 'Auto-throttle on anonymous users' field
3. click 'save configuration'
4. afterwards, you try the change of the value
5. however, it's impossible to change the value.
confirm it according to the above-mentioned procedure.
Comment #5
gregglesYes, I can confirm this issue and I confirm that your patch fixes it. I can't comment about whether or not your fix is the right way to fix it.
Comment #6
Takafumi commentedI have improved the patch.
This patch will not save an invalid value.
Comment #7
chx commentedusing $_POST is wrong in 5.0 . If you need , I can dug into the issue but this fix is not aceptable.
Comment #8
Takafumi commentedAnother way is to restore the default value.
Comment #9
edmund.kwok commentedThrottle settings should be validated in the _validate callback, not after the settings have been saved. Also removed _throttle_validate as it's not used anywhere else.
Comment #10
Takafumi commentedConfirmed it, and this patch works fine.
thanks.
Comment #11
dries commentedGood code, simple fix. Committed to CVS HEAD.
Comment #12
Takafumi commentedthanks.