From cb89616e1d7117a9d9e44ffc01fa6bcec0c1cdab Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 01 Oct 2009 02:50:48 -0400
Subject: [PATCH] Trigger warning if logs cannot be written

---
 program/include/main.inc |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/program/include/main.inc b/program/include/main.inc
index 97a3db1..6e4cbe1 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1042,12 +1042,15 @@
       $CONFIG['log_dir'] = INSTALL_PATH.'logs';
 
     // try to open specific log file for writing
-    if ($fp = @fopen($CONFIG['log_dir'].'/'.$name, 'a')) {
+    $logfile = $CONFIG['log_dir'].'/'.$name;
+    if ($fp = @fopen($logfile, 'a')) {
       fwrite($fp, $log_entry);
       fflush($fp);
       fclose($fp);
       return true;
     }
+    else
+      trigger_error("Error writing to log file $logfile; Please check permissions", E_USER_WARNING);
   }
   return false;
 }

--
Gitblit v1.9.1