Merge pull request #3310 from duritong/patch-1

only chmod logfile if necessary
This commit is contained in:
Morris Jobke 2017-04-04 11:42:26 -05:00 committed by GitHub
commit 52eaf6cfbb
1 changed files with 3 additions and 1 deletions

View File

@ -119,7 +119,9 @@ class File {
);
$entry = json_encode($entry);
$handle = @fopen(self::$logFile, 'a');
@chmod(self::$logFile, 0640);
if ((fileperms(self::$logFile) & 0777) != 0640) {
@chmod(self::$logFile, 0640);
}
if ($handle) {
fwrite($handle, $entry."\n");
fclose($handle);