From 258822f10abfe3ce6278487424b682cf029ee77f Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 4 Feb 2008 13:47:26 +0000 Subject: debug code for lastsent --- it.class | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/it.class b/it.class index 10cede4..083ca51 100644 --- a/it.class +++ b/it.class @@ -173,7 +173,11 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate if ($sendmail) { $lastsentfn = "/tmp/alertdata/lastsent_" . getmyuid() . "." . md5($p['to']); - if (($sendmail = time() - @filemtime($lastsentfn) > $p['blockmail'])) + $now = time(); + $lastsenttime = @filemtime($lastsentfn); + $sendmail = $now - $lastsenttime > $p['blockmail']; + $lastsentdebug = "Lastsent: lastsentfn=$lastsentfn now=$now lastsenttime=$lastsenttime blockmail={$p['blockmail']} sendmail=$sendmail\n\n"; + if ($sendmail) { @unlink($lastsentfn); @touch($lastsentfn); @@ -200,6 +204,7 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate $body .= "Host: " . getenv('HOSTNAME') . "\n\n"; $body .= $p['locals'] && strlen($locals) < 100000 ? "Locals: $locals\n\n" : ""; $body .= $p['id'] ? "Filter: graceperiod={$p['graceperiod']} timewindow={$p['timewindow']}\n\n" : ""; + $body .= $lastsentdebug; $body .= $_GET ? "\$_GET: " . print_r($_GET, true) . "\n\n" : ""; $body .= $_POST ? "\$_POST: " . print_r($_POST, true) . "\n\n" : ""; $body .= $_COOKIE ? "\$_COOKIE: " . print_r($_COOKIE, true) . "\n\n" : ""; -- cgit v1.2.3