summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2009-10-27 14:06:28 +0000
committerUrban Müller2009-10-27 14:06:28 +0000
commiteae3d00044cfd88f10352779d29dc0acf4bea53c (patch)
tree468432ec5749b6dfda4cf9cbedc2cf8d2ed4cbfa
parent1021938611e81caccb44d28029fa73a82680a7d4 (diff)
downloaditools-eae3d00044cfd88f10352779d29dc0acf4bea53c.tar.gz
itools-eae3d00044cfd88f10352779d29dc0acf4bea53c.tar.bz2
itools-eae3d00044cfd88f10352779d29dc0acf4bea53c.zip
prevent huge mails
-rw-r--r--it.class7
1 files changed, 7 insertions, 0 deletions
diff --git a/it.class b/it.class
index f5a8978..17f5658 100644
--- a/it.class
+++ b/it.class
@@ -194,6 +194,13 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate
if ($toscreen || $sendmail)
{
$trace = it_debug::backtrace($p['backtraceskip']); # moved in here for performance in mass error case
+
+ if (strlen($p['body']) > 500000)
+ {
+ file_put_contents($datafn = "/tmp/alertdata/error-" . substr(md5($p['body']), 0, 2), $p['body']);
+ $p['body'] = "Body: " . getenv('HOSTNAME') . ":$datafn";
+ }
+
$body = ($p['body'] ? trim($p['body'])."\n\n" : "") . ($url && !$toscreen? "{$p['title']}\n\nUrl: $url\n\n" : "") . ($trace ? ($sendmail?"" :" ")."Trace: $trace\n\n" : "");
if ($sendmail) # we're mailing: send maximum info