Check if log files are writeable

release-0.6
thomascube 19 years ago
parent 31b2cee231
commit 9fc381f4e8

@ -67,12 +67,18 @@ function log_bug($arg_arr)
if (empty($CONFIG['log_dir'])) if (empty($CONFIG['log_dir']))
$CONFIG['log_dir'] = $INSTALL_PATH.'logs'; $CONFIG['log_dir'] = $INSTALL_PATH.'logs';
if ($fp = fopen($CONFIG['log_dir'].'/errors', 'a')) // try to open specific log file for writing
if ($fp = @fopen($CONFIG['log_dir'].'/errors', 'a'))
{ {
fwrite($fp, $log_entry); fwrite($fp, $log_entry);
fclose($fp); fclose($fp);
} }
else
{
// send error to PHPs error handler
trigger_error($arg_arr['message']);
}
} }
/* /*

@ -283,7 +283,7 @@ if ($CONFIG['smtp_log'])
$mailto, $mailto,
$msg_subject); $msg_subject);
if ($fp = fopen($CONFIG['log_dir'].'/sendmail', 'a')) if ($fp = @fopen($CONFIG['log_dir'].'/sendmail', 'a'))
{ {
fwrite($fp, $log_entry); fwrite($fp, $log_entry);
fclose($fp); fclose($fp);

Loading…
Cancel
Save