TASK-208 Add validation for create log file

This commit is contained in:
Brayan Pereyra
2025-09-15 13:18:36 +00:00
parent 701efc90b2
commit 8be70e0dc1

View File

@@ -656,12 +656,11 @@ class AuthSources
private function log($link, $text) private function log($link, $text)
{ {
$logFile = PATH_DATA . 'logs/ldapAdvanced.log'; $logFile = PATH_DATA . 'logs/ldap.log';
// Validate log file exists and is writable
if (!file_exists($logFile)) { if (!file_exists($logFile)) {
error_log('Log file does not exist: ' . $logFile); file_put_contents($logFile, "Start\n");
throw new Exception('Log file does not exist: ' . $logFile); @chmod($logFile, 0644);
} }
if (!is_writable($logFile)) { if (!is_writable($logFile)) {