Commit a4ed940a authored by Dries's avatar Dries
Browse files

- Patch #104309 by jvandyck: documentation improvements.

parent bb2a637d
......@@ -28,10 +28,15 @@ function throttle_menu($may_cache) {
* Determine the current load on the site.
*
* Call the throttle_status() function from your own modules, themes, blocks,
* etc. to determine the current throttle status. For example, in your theme
* you might choose to disable pictures when your site is too busy (reducing
* bandwidth), or in your modules you might choose to disable some complicated
* logic when your site is too busy (reducing CPU utilization).
* etc. as follows:
*
* $throttle = module_invoke('throttle', 'status');
*
* to determine the current throttle status. Use module_invoke() so the
* call will still work if the throttle module is disabled. For example, in
* your theme you might choose to disable pictures when your site is too busy
* (reducing bandwidth), or in your modules you might choose to disable
* some complicated logic when your site is too busy (reducing CPU utilization).
*
* @return
* 0 or 1. 0 means that the throttle is currently disabled. 1 means that
......@@ -57,10 +62,15 @@ function throttle_exit() {
// limiting throttle related database calls to 1 in N.
if (!mt_rand(0, variable_get('throttle_probability_limiter', 9))) {
// Count users with activity in the past n seconds, defined in user module
$time_period = variable_get('user_block_seconds_online', 2700);
// Count users with activity in the past n seconds.
// This value is defined in the user module Who's Online block.
$time_period = variable_get('user_block_seconds_online', 900);
$throttle = module_invoke('throttle', 'status');
// When determining throttle status in your own module or theme, use
// $throttle = module_invoke('throttle', 'status');
// as that will still work when throttle.module is disabled.
// Clearly here the module is enabled so we call throttle_status() directly.
$throttle = throttle_status();
if ($max_guests = variable_get('throttle_anonymous', 0)) {
$guests = sess_count(time() - $time_period, TRUE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment