summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2007-08-06 14:33:27 +0000
committerUrban Müller2007-08-06 14:33:27 +0000
commite703a6394acfc60bfaedf21c94ec924a0e1c168a (patch)
tree3b19e8f1442b19c26b89fc0e6ef5f33abf0b0d6f
parent9fe36f72df3597e155d71e27eee91c86d6995193 (diff)
downloaditools-e703a6394acfc60bfaedf21c94ec924a0e1c168a.tar.gz
itools-e703a6394acfc60bfaedf21c94ec924a0e1c168a.tar.bz2
itools-e703a6394acfc60bfaedf21c94ec924a0e1c168a.zip
prevent load explosions in case of mass alerts
-rw-r--r--it.class9
1 files changed, 8 insertions, 1 deletions
diff --git a/it.class b/it.class
index 277439a..4fa274a 100644
--- a/it.class
+++ b/it.class
@@ -101,6 +101,7 @@ function error($p = array(), $body = "", $to = "")
{
$stampfn = $GLOBALS['ULTRAHOME'] . "/tmp/errstamp_" . urlencode($p['id']);
$stampage = time() - @filemtime($stampfn);
+ $lastsentfn = "/tmp/alertdata/" . $p['id'];
if ($stampage >= $p['graceperiod'] && $stampage <= $p['graceperiod'] + $p['timewindow'])
$sendalert = true;
@@ -109,10 +110,16 @@ function error($p = array(), $body = "", $to = "")
touch($stampfn);
}
else
+ {
+ $lastsentfn = "/tmp/alertdata/" . getmyuid() . "." . $to;
$sendalert = true;
+ }
- if ($sendalert)
+ if ($sendalert && (time() - @filemtime($lastsentfn)) > 3600)
{
+ mkdir("/tmp/alertdata");
+ touch($lastsentfn);
+
$url = ($_SERVER['HTTPS'] ? "https://" : "http://") . $_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI'];
if (!$title)
$title="Error in $url";