From 451a90645b538c603d4028d4ee77729d516e5cce Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 4 Dec 2003 22:42:19 +0000 Subject: [PATCH] - Fixed throttle block problem. Patch by Jeremy. --- modules/throttle.module | 8 +++++--- modules/throttle/throttle.module | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/throttle.module b/modules/throttle.module index 5186fd60ed8..f94a79f79c7 100644 --- a/modules/throttle.module +++ b/modules/throttle.module @@ -155,9 +155,11 @@ function throttle_display_throttle_block() { $output .= t("Current level: %level (%min+)", array("%level" => $throttle, "%min" => $minimum)) ."
\n"; } $output .= t("Probability: %probability%", array("%probability" => $probability)) ."
\n"; - $recent_activity = db_fetch_object(db_query("SELECT COUNT(timestamp) AS hits FROM {accesslog} WHERE timestamp >= %d", (time() - 60))); - $output .= "
". t("This site has served %hits in the past minute.", array("%hits" => format_plural($recent_activity->hits , "1 page", "%count pages"))); - _throttle_update($recent_activity->hits); + if ($throttle < 5) { + $recent_activity = db_fetch_object(db_query("SELECT COUNT(timestamp) AS hits FROM {accesslog} WHERE timestamp >= %d", (time() - 60))); + $output .= "
". t("This site has served %pages in the past minute.", array("%pages" => format_plural($recent_activity->hits , "1 page", "%count pages"))); + _throttle_update($recent_activity->hits); + } } else { $output .= t("Throttle: %status", array("%status" => l(t("disabled"), "admin/system/modules/throttle"))) ."
\n"; diff --git a/modules/throttle/throttle.module b/modules/throttle/throttle.module index 5186fd60ed8..f94a79f79c7 100644 --- a/modules/throttle/throttle.module +++ b/modules/throttle/throttle.module @@ -155,9 +155,11 @@ function throttle_display_throttle_block() { $output .= t("Current level: %level (%min+)", array("%level" => $throttle, "%min" => $minimum)) ."
\n"; } $output .= t("Probability: %probability%", array("%probability" => $probability)) ."
\n"; - $recent_activity = db_fetch_object(db_query("SELECT COUNT(timestamp) AS hits FROM {accesslog} WHERE timestamp >= %d", (time() - 60))); - $output .= "
". t("This site has served %hits in the past minute.", array("%hits" => format_plural($recent_activity->hits , "1 page", "%count pages"))); - _throttle_update($recent_activity->hits); + if ($throttle < 5) { + $recent_activity = db_fetch_object(db_query("SELECT COUNT(timestamp) AS hits FROM {accesslog} WHERE timestamp >= %d", (time() - 60))); + $output .= "
". t("This site has served %pages in the past minute.", array("%pages" => format_plural($recent_activity->hits , "1 page", "%count pages"))); + _throttle_update($recent_activity->hits); + } } else { $output .= t("Throttle: %status", array("%status" => l(t("disabled"), "admin/system/modules/throttle"))) ."
\n";