diff options
author | Urban Müller | 2009-10-27 14:06:28 +0000 |
---|---|---|
committer | Urban Müller | 2009-10-27 14:06:28 +0000 |
commit | eae3d00044cfd88f10352779d29dc0acf4bea53c (patch) | |
tree | 468432ec5749b6dfda4cf9cbedc2cf8d2ed4cbfa /it.class | |
parent | 1021938611e81caccb44d28029fa73a82680a7d4 (diff) | |
download | itools-eae3d00044cfd88f10352779d29dc0acf4bea53c.tar.gz itools-eae3d00044cfd88f10352779d29dc0acf4bea53c.tar.bz2 itools-eae3d00044cfd88f10352779d29dc0acf4bea53c.zip |
prevent huge mails
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 |