FIX Do not delete files into sym links

This commit is contained in:
Laurent Destailleur
2017-08-21 00:40:32 +02:00
parent 083cb33a6c
commit b9511fd4c6

View File

@@ -287,7 +287,7 @@ function dol_dir_list_in_database($path, $filter="", $excludefilter=null, $sortc
/**
* Complete $filearray with data from database.
* This will call doldir_list_indatabase to complate filearray.
*
*
* @param $filearray Array of files get using dol_dir_list
* @param $relativedir Relative dir from DOL_DATA_ROOT
* @return void
@@ -295,7 +295,7 @@ function dol_dir_list_in_database($path, $filter="", $excludefilter=null, $sortc
function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir)
{
global $db, $user;
$filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC);
//var_dump($filearray);
@@ -672,7 +672,7 @@ function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
}
/**
* Copy a dir to another dir.
* Copy a dir to another dir. This include recursive subdirectories.
*
* @param string $srcfile Source file (a directory)
* @param string $destfile Destination file (a directory)
@@ -716,7 +716,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep
{
if ($file!="." && $file!="..")
{
if (is_dir($ossrcfile."/".$file))
if (is_dir($ossrcfile."/".$file) && ! is_link($ossrcfile."/".$file))
{
//var_dump("xxx dolCopyDir $srcfile/$file, $destfile/$file, $newmask, $overwriteifexists");
$tmpresult=dolCopyDir($srcfile."/".$file, $destfile."/".$file, $newmask, $overwriteifexists, $arrayreplacement);
@@ -1084,7 +1084,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
/**
* Remove a file or several files with a mask.
* This delete file physically but also database indexes.
* This delete file physically but also database indexes.
*
* @param string $file File to delete or mask of files to delete
* @param int $disableglob Disable usage of glob like * so function is an exact delete function that will return error if no file found
@@ -1239,7 +1239,7 @@ function dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$
if ($item != "." && $item != "..")
{
if (is_dir(dol_osencode("$dir/$item")))
if (is_dir(dol_osencode("$dir/$item")) && ! is_link(dol_osencode("$dir/$item")))
{
$count=dol_delete_dir_recursive("$dir/$item", $count, $nophperrors, 0, $countdeleted);
}
@@ -1334,7 +1334,7 @@ function dol_meta_create($object)
{
global $conf;
// Create meta file
// Create meta file
if (empty($conf->global->MAIN_DOC_CREATE_METAFILE)) return 0; // By default, no metafile.
// Define parent dir of elements
@@ -1391,7 +1391,7 @@ function dol_meta_create($object)
return 1;
}
else
else
{
dol_syslog('FailedToDetectDirInDolMetaCreateFor'.$object->element, LOG_WARNING);
}