From 7e1527ee61bc10b3765b95b9af8faaa2254da5a8 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 7 Oct 2005 06:11:12 +0000 Subject: - Patch #29465: new form API by Adrian et al. TODO: + The contact.module was broken; a new patch for contact.module is needed. + Documentation is needed. + The most important modules need to be updated ASAP. --- modules/throttle/throttle.module | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'modules/throttle') diff --git a/modules/throttle/throttle.module b/modules/throttle/throttle.module index 069729cf8..a5f08e1e7 100644 --- a/modules/throttle/throttle.module +++ b/modules/throttle/throttle.module @@ -121,12 +121,31 @@ function throttle_help($section) { function throttle_settings() { _throttle_validate(variable_get('throttle_anonymous', ''), 'throttle_anonymous'); _throttle_validate(variable_get('throttle_user', ''), 'throttle_user'); - $output = form_textfield(t('Auto-throttle on anonymous users'), 'throttle_anonymous', variable_get('throttle_anonymous', 0), 5, 6, t('The congestion control throttle can be automatically enabled when the number of anonymous users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 250 anonymous users online at once, enter \'250\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on anonymous users. You can inspect the current number of anonymous users using the "Who\'s online" block.')); - $output .= form_textfield(t('Auto-throttle on authenticated users'), 'throttle_user', variable_get('throttle_user', 0), 5, 6, t('The congestion control throttle can be automatically enabled when the number of authenticated users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 50 registered users online at once, enter \'50\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on authenticated users. You can inspect the current number of authenticated users using the "Who\'s online" block.')); $probabilities = array(0 => '100%', 1 => '50%', 2 => '33.3%', 3 => '25%', 4 => '20%', 5 => '16.6%', 7 => '12.5%', 9 => '10%', 19 => '5%', 99 => '1%', 199 => '.5%', 399 => '.25%', 989 => '.1%'); - $output .= form_select(t('Auto-throttle probability limiter'), 'throttle_probability_limiter', variable_get('throttle_probability_limiter', 9), $probabilities, t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.')); + + $form['throttle_anonymous'] = array( + type => 'textfield', + title => t('Auto-throttle on anonymous users'), + default_value => variable_get('throttle_anonymous', 0), + size => 5, + maxlength => 6, + description => t('The congestion control throttle can be automatically enabled when the number of anonymous users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 250 anonymous users online at once, enter \'250\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on anonymous users. You can inspect the current number of anonymous users using the "Who\'s online" block.') + ); + $form['throttle_user'] = array( + type => 'textfield', + title => t('Auto-throttle on authenticated users'), + default_value => variable_get('throttle_user', 0), + size => 5, + maxlength => 6, + description => t('The congestion control throttle can be automatically enabled when the number of authenticated users currently visiting your site exceeds the specified threshold. For example, to start the throttle when your site has 50 registered users online at once, enter \'50\' in this field. Leave this value blank or set to "0" if you do not wish to auto-throttle on authenticated users. You can inspect the current number of authenticated users using the "Who\'s online" block.') + ); + $form['throttle_probability_limiter'] = array( + type => 'select', + title => t('Auto-throttle probability limiter'), + default_value => variable_get('throttle_probability_limiter', 9), + options => $probabilities, + description => t('The auto-throttle probability limiter is an efficiency mechanism to statistically reduce the overhead of the auto-throttle. The limiter is expressed as a percentage of page views, so for example if set to the default of 10% we only perform the extra database queries to update the throttle status 1 out of every 10 page views. The busier your site, the lower you should set the limiter value.') + ); - return $output; + return $form; } - - -- cgit v1.2.3