- fixed chmod(0666) for log log files

This commit is contained in:
Mark Friedrich
2019-07-21 15:50:28 +02:00
parent b96e95ca4a
commit 82f69d7216

View File

@@ -44,11 +44,15 @@ class LogFileHandler {
public function write(array $log){
$log = (string)json_encode($log, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
if( !empty($log) ){
$stream = fopen($this->stream, 'a');
flock($stream, LOCK_EX);
fwrite($stream, $log . PHP_EOL);
flock($stream, LOCK_UN);
fclose($stream);
if($stream = fopen($this->stream, 'a')){
flock($stream, LOCK_EX);
fwrite($stream, $log . PHP_EOL);
flock($stream, LOCK_UN);
fclose($stream);
// logs should be writable for non webSocket user too
@chmod($this->stream, 0666);
}
}
}