Skip to content

Commit

Permalink
FIX Do not delete files into sym links
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 20, 2017
1 parent 083cb33 commit b9511fd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions htdocs/core/lib/files.lib.php
Expand Up @@ -287,15 +287,15 @@ 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
*/
function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir)
{
global $db, $user;

$filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC);

//var_dump($filearray);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1391,7 +1391,7 @@ function dol_meta_create($object)

return 1;
}
else
else
{
dol_syslog('FailedToDetectDirInDolMetaCreateFor'.$object->element, LOG_WARNING);
}
Expand Down

0 comments on commit b9511fd

Please sign in to comment.