mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
admin/setup: change file content instead of recreate config file
This commit is contained in:
@@ -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));
|
@chmod($file, $mod & ~umask());
|
||||||
|
|
||||||
if (false !== @file_put_contents($tmpFile, $content)) {
|
if (false === @file_put_contents($file, $content)) {
|
||||||
// rename does not work on Win32 before 5.2.6
|
throw new RuntimeException(sprintf('Unable to write %s', $file));
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user