log db errors to syslog and remove tmp-error-logs for reporting in cronrun
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -346,11 +346,10 @@ class Database {
|
|||||||
if (!file_exists($sl_dir)) {
|
if (!file_exists($sl_dir)) {
|
||||||
@mkdir($sl_dir, 0755);
|
@mkdir($sl_dir, 0755);
|
||||||
}
|
}
|
||||||
$sl_file = makeCorrectFile($sl_dir."/sql-error.log");
|
openlog("froxlor", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||||
$sqllog = @fopen($sl_file, 'a');
|
syslog(LOG_WARNING, str_replace("\n", " ", $error_message));
|
||||||
@fwrite($sqllog, date('d.m.Y H:i', time())." --- ".str_replace("\n", " ", $error_message)."\n");
|
syslog(LOG_WARNING, str_replace("\n", " ", "--- DEBUG: ".$error_trace));
|
||||||
@fwrite($sqllog, date('d.m.Y H:i', time())." --- DEBUG: \n".$error_trace."\n");
|
closelog();
|
||||||
@fclose($sqllog);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* log error for reporting
|
* log error for reporting
|
||||||
@@ -400,7 +399,7 @@ class Database {
|
|||||||
die($err_hint);
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ class ConfigIO {
|
|||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function cleanUp() {
|
public function cleanUp() {
|
||||||
|
|
||||||
|
// old error logs
|
||||||
|
$this->_cleanErrLogs();
|
||||||
|
|
||||||
// awstats files
|
// awstats files
|
||||||
$this->_cleanAwstatsFiles();
|
$this->_cleanAwstatsFiles();
|
||||||
|
|
||||||
@@ -52,6 +56,17 @@ class ConfigIO {
|
|||||||
$this->_cleanCustomerSslCerts();
|
$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
|
* remove customer-specified auto-generated ssl-certificates
|
||||||
* (they are being regenerated)
|
* (they are being regenerated)
|
||||||
|
|||||||
Reference in New Issue
Block a user