Print a useful error if logfile is not writable (#15233)

This commit is contained in:
Tony Murray
2023-08-19 09:09:00 -05:00
committed by GitHub
parent a3fbed30bb
commit 47dfb34cf0

View File

@@ -108,7 +108,15 @@ function parse_modules($type, $options)
function logfile($string)
{
$fd = fopen(Config::get('log_file'), 'a');
$file = Config::get('log_file');
$fd = fopen($file, 'a');
if ($fd === false) {
print_error("Error: Could not write to log file: $file");
return;
}
fputs($fd, $string . "\n");
fclose($fd);
}