Fix: Pb with config file backup
This commit is contained in:
parent
739e8941a2
commit
c174229d64
@ -208,7 +208,9 @@ if ($_POST["action"] == "set")
|
|||||||
// Save old conf file on disk
|
// Save old conf file on disk
|
||||||
if (file_exists("$conffile"))
|
if (file_exists("$conffile"))
|
||||||
{
|
{
|
||||||
@dol_copy($conffile, $conffile.'.old'); // We must ignore errors as an existing old file may alreday exists and not be replacable
|
// We must ignore errors as an existing old file may alreday exists and not be replacable
|
||||||
|
// Also no other process must be able to read file or we expose the new file so content with password.
|
||||||
|
@dol_copy($conffile, $conffile.'.old', '0400');
|
||||||
}
|
}
|
||||||
|
|
||||||
$error+=write_conf_file($conffile);
|
$error+=write_conf_file($conffile);
|
||||||
|
|||||||
@ -304,11 +304,17 @@ function dol_is_file($pathoffile)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy a file to another file
|
* Copy a file to another file
|
||||||
|
* @param $srcfile Source file
|
||||||
|
* @param $destfile Destination file
|
||||||
|
* @param $newmask Mask for new file
|
||||||
* @return boolean True if OK, false if KO
|
* @return boolean True if OK, false if KO
|
||||||
*/
|
*/
|
||||||
function dol_copy($srcfile, $destfile)
|
function dol_copy($srcfile, $destfile, $newmask)
|
||||||
{
|
{
|
||||||
return @copy($srcfile, $destfile);
|
dol_syslog("files.lib.php::dol_copy srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask);
|
||||||
|
$result=@copy($srcfile, $destfile);
|
||||||
|
@chmod($file, octdec($newmask)); // File must not be readable by any others
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user