Make flock writing easier

This commit is contained in:
Philipp Holzer 2023-01-04 08:16:40 +01:00
parent c057954896
commit aabe39220d
Signed by: nupplaPhil
GPG Key ID: 24A7501396EB5432
1 changed files with 1 additions and 2 deletions

View File

@ -214,10 +214,9 @@ class ConfigFileManager
throw new ConfigFileException('config source cannot get encoded');
}
$configStream = fopen($this->configDir . '/' . self::CONFIG_DATA_FILE, 'w+');
$configStream = fopen($this->configDir . '/' . self::CONFIG_DATA_FILE, 'w');
if (flock($configStream, LOCK_EX)) {
ftruncate($configStream, 0);
fwrite($configStream, $encodedData);
fflush($configStream);
flock($configStream, LOCK_UN);