Merge pull request #2726 from aynsix/PHRAS-2205-saving-configuration-file

PHRAS-2205 Change the configuration file content update methode : when saving from admin/setup
This commit is contained in:
Nicolas Maillat
2018-09-04 11:45:36 +02:00
committed by GitHub

View File

@@ -234,19 +234,11 @@ 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($file, $content)){
throw new RuntimeException(sprintf('Unable to write %s', $file));
if (false !== @file_put_contents($tmpFile, $content)) { }else{
// rename does not work on Win32 before 5.2.6 @chmod($file, $mod & ~umask());
if (@rename($tmpFile, $file)) {
@chmod($file, $mod & ~umask());
return;
}
} }
unlink($tmpFile);
throw new RuntimeException(sprintf('Unable to write %s', $file));
} }
private function eraseFile($file) private function eraseFile($file)