From eae3d00044cfd88f10352779d29dc0acf4bea53c Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 27 Oct 2009 14:06:28 +0000 Subject: prevent huge mails --- it.class | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- cgit v1.2.3