Skip to content

Commit

Permalink
Merge branch '7.0' of https://github.com/Dolibarr/dolibarr.git into 7…
Browse files Browse the repository at this point in the history
….0_bug5
  • Loading branch information
hregis committed Mar 5, 2018
2 parents 6473318 + 44eb50c commit 722fbc9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion htdocs/admin/tools/purge.php
Expand Up @@ -86,7 +86,7 @@
$filelogparam=$filelog;
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog)))
{
$filelogparam ='<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file=';
$filelogparam ='<a class="wordbreak" href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file=';
$filelogparam.=basename($filelog);
$filelogparam.='">'.$filelog.'</a>';
}
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/class/utils.class.php
Expand Up @@ -67,7 +67,7 @@ function purgeFiles($choice='tempfilesold')
// Delete temporary files
if ($dolibarr_main_data_root)
{
$filesarray=dol_dir_list($dolibarr_main_data_root,"directories",1,'^temp$','','','',2);
$filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', 'name', SORT_ASC, 2, 0, '', 1); // Do not follow symlinks
if ($choice == 'tempfilesold')
{
$now = dol_now();
Expand All @@ -81,10 +81,10 @@ function purgeFiles($choice='tempfilesold')

if ($choice=='allfiles')
{
// Delete all files (except install.lock)
// Delete all files (except install.lock, do not follow symbolic links)
if ($dolibarr_main_data_root)
{
$filesarray=dol_dir_list($dolibarr_main_data_root,"all",0,'','install\.lock$');
$filesarray=dol_dir_list($dolibarr_main_data_root, "all", 0, '', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1);
}
}

Expand All @@ -93,7 +93,7 @@ function purgeFiles($choice='tempfilesold')
// Define files log
if ($dolibarr_main_data_root)
{
$filesarray=dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*$', 'install\.lock$');
$filesarray=dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*$', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1);
}

$filelog='';
Expand Down
9 changes: 7 additions & 2 deletions htdocs/core/lib/files.lib.php
Expand Up @@ -52,10 +52,11 @@ function dol_basename($pathfile)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @param int $nohook Disable all hooks
* @param string $relativename For recursive purpose only. Must be "" at first call.
* @param string $donotfollowsymlinks Do not follow symbolic links
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)
* @see dol_dir_list_indatabase
*/
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
{
global $db, $hookmanager;
global $object;
Expand Down Expand Up @@ -159,7 +160,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
// if we're in a directory and we want recursive behavior, call this function again
if ($recursive)
{
$file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename!=''?$relativename.'/':'').$file));
if (empty($donotfollowsymlinks) || ! is_link($path."/".$file))
{
//var_dump('eee '. $path."/".$file. ' '.is_dir($path."/".$file).' '.is_link($path."/".$file));
$file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename!=''?$relativename.'/':'').$file, $donotfollowsymlinks));
}
}
}
else if (! $isdir && (($types == "files") || ($types == "all")))
Expand Down

0 comments on commit 722fbc9

Please sign in to comment.