mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-03 23:52:24 +01:00
FIX: Better error management in loading a website template
This commit is contained in:
@@ -857,14 +857,14 @@ function dol_copy($srcfile, $destfile, $newmask = '0', $overwriteifexists = 1, $
|
||||
/**
|
||||
* Copy a dir to another dir. This include recursive subdirectories.
|
||||
*
|
||||
* @param string $srcfile Source file (a directory)
|
||||
* @param string $destfile Destination file (a directory)
|
||||
* @param string $newmask Mask for new file ('0' by default means getDolGlobalString('MAIN_UMASK')). Example: '0666'
|
||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @param string $srcfile Source file (a directory)
|
||||
* @param string $destfile Destination file (a directory)
|
||||
* @param string $newmask Mask for new file ('0' by default means getDolGlobalString('MAIN_UMASK')). Example: '0666'
|
||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @param array<string,string> $arrayreplacement Array to use to replace filenames with another one during the copy (works only on file names, not on directory names).
|
||||
* @param int $excludesubdir 0=Do not exclude subdirectories, 1=Exclude subdirectories, 2=Exclude subdirectories if name is not a 2 chars (used for country codes subdirectories).
|
||||
* @param string[] $excludefileext Exclude some file extensions
|
||||
* @return int Return integer <0 if error, 0 if nothing done (all files already exists and overwriteifexists=0), >0 if OK
|
||||
* @param int $excludesubdir 0=Do not exclude subdirectories, 1=Exclude subdirectories, 2=Exclude subdirectories if name is not a 2 chars (used for country codes subdirectories).
|
||||
* @param string[] $excludefileext Exclude some file extensions
|
||||
* @return int Return integer <0 if error, 0 if nothing done (all files already exists and overwriteifexists=0), >0 if OK
|
||||
* @see dol_copy()
|
||||
*/
|
||||
function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement = null, $excludesubdir = 0, $excludefileext = null)
|
||||
@@ -878,6 +878,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep
|
||||
}
|
||||
|
||||
$destexists = dol_is_dir($destfile);
|
||||
|
||||
//if (! $overwriteifexists && $destexists) return 0; // The overwriteifexists is for files only, so propagated to dol_copy only.
|
||||
|
||||
if (!$destexists) {
|
||||
@@ -888,7 +889,13 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep
|
||||
$dirmaskdec = octdec(getDolGlobalString('MAIN_UMASK'));
|
||||
}
|
||||
$dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files
|
||||
dol_mkdir($destfile, '', decoct($dirmaskdec));
|
||||
|
||||
$result = dol_mkdir($destfile, '', decoct($dirmaskdec));
|
||||
|
||||
if (!dol_is_dir($destfile)) {
|
||||
// The output directory does not exists and we failed to create it. So we stop here.
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$ossrcfile = dol_osencode($srcfile);
|
||||
|
||||
Reference in New Issue
Block a user