admin/setup: change file content instead of recreate config file

This commit is contained in:
aina-esokia
2018-09-03 14:58:05 +04:00
parent 9975b99861
commit 354c918a90

View File

@@ -234,19 +234,12 @@ class Configuration implements ConfigurationInterface
private function dumpFile($file, $content, $mod = 0600) private function dumpFile($file, $content, $mod = 0600)
{ {
$tmpFile = tempnam(dirname($file), basename($file));
if (false !== @file_put_contents($tmpFile, $content)) {
// rename does not work on Win32 before 5.2.6
if (@rename($tmpFile, $file)) {
@chmod($file, $mod & ~umask()); @chmod($file, $mod & ~umask());
return; if (false === @file_put_contents($file, $content)) {
} throw new RuntimeException(sprintf('Unable to write %s', $file));
} }
unlink($tmpFile);
throw new RuntimeException(sprintf('Unable to write %s', $file));
} }
private function eraseFile($file) private function eraseFile($file)