gitignore and file creation

This commit is contained in:
HB9HIL
2024-07-22 13:36:38 +02:00
parent 6a542111ee
commit ed59ce9b02
3 changed files with 37 additions and 8 deletions

1
.gitignore vendored
View File

@@ -8,6 +8,7 @@
/uploads/*.tq8 /uploads/*.tq8
/uploads/*.TQ8 /uploads/*.TQ8
/install/.lock /install/.lock
/install/log/debug.log
/updates/*.xml /updates/*.xml
/updates/*.html /updates/*.html
/images/eqsl_card_images/*.jpg /images/eqsl_card_images/*.jpg

View File

@@ -57,20 +57,48 @@ function is_really_writable($path) {
return false; return false;
} }
function verify_log() {
global $logfile;
if (!file_exists($logfile)) {
if (touch($logfile)) {
if(is_writable($logfile)) {
$log_header = "Wavelog Installer Debug Log\n-------\n\n";
file_put_contents($logfile, $log_header, FILE_APPEND);
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return is_writable($logfile);
}
}
// Function to read the debug logfile // Function to read the debug logfile
function read_logfile() { function read_logfile() {
global $logfile; if (verify_log()) {
$file_content = file_get_contents($logfile); global $logfile;
echo $file_content; $file_content = file_get_contents($logfile);
echo $file_content;
} else {
echo "Log file is not available.";
}
} }
// Function to log messages in the installer logfile // Function to log messages in the installer logfile
function log_message($level, $message) { function log_message($level, $message) {
global $logfile; if (verify_log()) {
$level = strtoupper($level); global $logfile;
$timestamp = date("Y-m-d H:i:s"); $level = strtoupper($level);
$logMessage = $level . " - " . $timestamp . " --> " . $message . PHP_EOL; $timestamp = date("Y-m-d H:i:s");
file_put_contents($logfile, $logMessage, FILE_APPEND); $logMessage = $level . " - " . $timestamp . " --> " . $message . PHP_EOL;
file_put_contents($logfile, $logMessage, FILE_APPEND);
} else {
echo "Log file is not available or not writable.";
}
} }
// Custom error handler // Custom error handler

0
install/log/.keep Normal file
View File