summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-12-07 18:25:09 +0000
committerDries Buytaert <dries@buytaert.net>2003-12-07 18:25:09 +0000
commitbea3dbb77574cb5b4274c318b01443d640d5c87b (patch)
tree2d339c9a52a0dc6f5ce275de2c355e0cbe7d3a92 /includes
parent71eac6dddc79d5b2ad3567969743269534bfc9d6 (diff)
downloadbrdo-bea3dbb77574cb5b4274c318b01443d640d5c87b.tar.gz
brdo-bea3dbb77574cb5b4274c318b01443d640d5c87b.tar.bz2
- Patch 0185 by Jeremy: made it possible to automatically disable modules when
under heave load.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc3
-rw-r--r--includes/module.inc12
2 files changed, 9 insertions, 6 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 337090710..842279a91 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -129,9 +129,6 @@ function throttle($type, $rate) {
watchdog("warning", "throttle: '". getenv("REMOTE_ADDR") ."' exceeded submission rate - $throttle->type");
die(message_throttle());
}
- else {
- watchdog($type, "throttle");
- }
}
}
diff --git a/includes/module.inc b/includes/module.inc
index 787f072f2..a3e8bbb13 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -50,13 +50,19 @@ function module_list($refresh = 0, $bootstrap = 0) {
if (!$list) {
$list = array("admin" => "admin", "system" => "system", "user" => "user", "watchdog" => "watchdog");
- $result = db_query("SELECT name, filename, bootstrap FROM {system} WHERE type = 'module' AND status = '1' ORDER BY name");
+ $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = '1' ORDER BY name");
while ($module = db_fetch_object($result)) {
if (file_exists($module->filename)) {
- if ($bootstrap) {
+ /*
+ ** Determine the current throttle status and see if module should be
+ ** loaded based on server load. We have to directly access the
+ ** throttle variables as the throttle.module may not be loaded yet.
+ */
+ $throttle = (variable_get("throttle_enable", 0) && $module->throttle && (variable_get("throttle_level", 0) >= 5));
+ if ($bootstrap && !$throttle) {
$list[$module->name] = array("name"=> $module->name, "bootstrap" => $module->bootstrap, "filename" => $module->filename);
}
- else {
+ else if (!$throttle) {
$list[$module->name] = $module->name;
include_once $module->filename;
}