Make flock writing easier
This commit is contained in:
parent
c057954896
commit
aabe39220d
|
@ -214,10 +214,9 @@ class ConfigFileManager
|
||||||
throw new ConfigFileException('config source cannot get encoded');
|
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)) {
|
if (flock($configStream, LOCK_EX)) {
|
||||||
ftruncate($configStream, 0);
|
|
||||||
fwrite($configStream, $encodedData);
|
fwrite($configStream, $encodedData);
|
||||||
fflush($configStream);
|
fflush($configStream);
|
||||||
flock($configStream, LOCK_UN);
|
flock($configStream, LOCK_UN);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user