diff --git a/lib/classes/database/class.Database.php b/lib/classes/database/class.Database.php index 85ed594b..12c459ca 100644 --- a/lib/classes/database/class.Database.php +++ b/lib/classes/database/class.Database.php @@ -346,11 +346,10 @@ class Database { if (!file_exists($sl_dir)) { @mkdir($sl_dir, 0755); } - $sl_file = makeCorrectFile($sl_dir."/sql-error.log"); - $sqllog = @fopen($sl_file, 'a'); - @fwrite($sqllog, date('d.m.Y H:i', time())." --- ".str_replace("\n", " ", $error_message)."\n"); - @fwrite($sqllog, date('d.m.Y H:i', time())." --- DEBUG: \n".$error_trace."\n"); - @fclose($sqllog); + openlog("froxlor", LOG_PID | LOG_PERROR, LOG_LOCAL0); + syslog(LOG_WARNING, str_replace("\n", " ", $error_message)); + syslog(LOG_WARNING, str_replace("\n", " ", "--- DEBUG: ".$error_trace)); + closelog(); /** * log error for reporting @@ -400,7 +399,7 @@ class Database { die($err_hint); } } - die("We are sorry, but a MySQL - error occurred. The administrator may find more information in in the sql-error.log in the logs/ directory"); + die("We are sorry, but a MySQL - error occurred. The administrator may find more information in the syslog"); } } } diff --git a/lib/classes/webserver/class.ConfigIO.php b/lib/classes/webserver/class.ConfigIO.php index e2741557..9de1df92 100644 --- a/lib/classes/webserver/class.ConfigIO.php +++ b/lib/classes/webserver/class.ConfigIO.php @@ -33,6 +33,10 @@ class ConfigIO { * @return null */ public function cleanUp() { + + // old error logs + $this->_cleanErrLogs(); + // awstats files $this->_cleanAwstatsFiles(); @@ -52,6 +56,17 @@ class ConfigIO { $this->_cleanCustomerSslCerts(); } + private function _cleanErrLogs() { + + $err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/"); + if (@is_dir($err_dir)) { + // now get rid of old stuff + //(but append /*.log so we don't delete the directory) + $err_dir.='/*.log'; + safe_exec('rm -rf '. makeCorrectFile($err_dir)); + } + } + /** * remove customer-specified auto-generated ssl-certificates * (they are being regenerated)