Merge branch '7.0' of https://github.com/Dolibarr/dolibarr.git into 7.0_bug5

This commit is contained in:
Regis Houssin 2018-03-05 10:25:23 +01:00
commit 722fbc9d29
3 changed files with 12 additions and 7 deletions

View File

@ -86,7 +86,7 @@ if (! empty($conf->syslog->enabled))
$filelogparam=$filelog; $filelogparam=$filelog;
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($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.=basename($filelog);
$filelogparam.='">'.$filelog.'</a>'; $filelogparam.='">'.$filelog.'</a>';
} }

View File

@ -67,7 +67,7 @@ class Utils
// Delete temporary files // Delete temporary files
if ($dolibarr_main_data_root) 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') if ($choice == 'tempfilesold')
{ {
$now = dol_now(); $now = dol_now();
@ -81,10 +81,10 @@ class Utils
if ($choice=='allfiles') 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) 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);
} }
} }
@ -93,7 +93,7 @@ class Utils
// Define files log // Define files log
if ($dolibarr_main_data_root) 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=''; $filelog='';

View File

@ -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 $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 int $nohook Disable all hooks
* @param string $relativename For recursive purpose only. Must be "" at first call. * @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',...) * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)
* @see dol_dir_list_indatabase * @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 $db, $hookmanager;
global $object; global $object;
@ -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 we're in a directory and we want recursive behavior, call this function again
if ($recursive) 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"))) else if (! $isdir && (($types == "files") || ($types == "all")))