summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2007-11-28 18:28:16 +0000
committerUrban Müller2007-11-28 18:28:16 +0000
commitfc907558734ce439f5df2e16ffe1be7b5f30860b (patch)
treefbde3ea30c9fdb934a0667f8260b9f7506cfb9f3 /it.class
parent5774575030ccedf614c619052bc8c3758e7511d1 (diff)
downloaditools-fc907558734ce439f5df2e16ffe1be7b5f30860b.tar.gz
itools-fc907558734ce439f5df2e16ffe1be7b5f30860b.tar.bz2
itools-fc907558734ce439f5df2e16ffe1be7b5f30860b.zip
dont create stderr for suppressed errors in cli mode
Diffstat (limited to 'it.class')
-rw-r--r--it.class16
1 files changed, 11 insertions, 5 deletions
diff --git a/it.class b/it.class
index 056300a..a4231bb 100644
--- a/it.class
+++ b/it.class
@@ -150,12 +150,12 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate
'blockmail' => 3600,
);
+ @mkdir("/tmp/alertdata");
+ @chmod("/tmp/alertdata", 0777);
+
$toscreen = ini_get('display_errors') || (defined("STDOUT") && posix_isatty(STDOUT)) || EDC('astwin') || EDC('asdevel');
if (!$toscreen) # this error can only be sent by mail: find out if we want to suppress it
{
- @mkdir("/tmp/alertdata");
- @chmod("/tmp/alertdata", 0777);
-
if (!$p['id'])
$sendmail = true;
else
@@ -209,11 +209,17 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate
mail($p['to'], $p['title'], $body, ($cc = $GLOBALS['it_defaultconfig']['error_cc']) ? "Cc: $cc" : null);
}
- else if ($_SERVER['REMOTE_ADDR']) # in shell mode we rely on error_log below
+ else if ($_SERVER['REMOTE_ADDR']) # toscreen mode: web
echo "<pre>{$p['title']}\n$body</pre>";
+ else # toscreen mode: shell (outputs to stderr)
+ error_log("it::error: " . $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']}") . " Url: $url " . (EDC('verbose') ? D($p['locals']) : ""));
}
- error_log("it::error: " . $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']}") . " Url: $url " . (EDC('verbose') ? D($p['locals']) : ""));
+ if (($fh = fopen("/tmp/alertdata/alert.log", "a"))) {
+ fputs($fh, $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']}") . " Url: $url\n");
+ fclose($fh);
+ @chmod("/tmp/alertdata/alert.log", 0777);
+ }
}