The hook getNodeList has been replaced by a normalized 'addreplace' hook

getDirList.
This commit is contained in:
Laurent Destailleur
2017-02-27 02:04:47 +01:00
parent 74e8fb9c19
commit d12caab69a

View File

@@ -68,6 +68,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
$path=preg_replace('/([\\/]+)$/i','',$path); $path=preg_replace('/([\\/]+)$/i','',$path);
$newpath=dol_osencode($path); $newpath=dol_osencode($path);
$reshook = 0;
$file_list = array();
$hookmanager->resArray=array();
if (! $nohook) if (! $nohook)
{ {
$hookmanager->initHooks(array('fileslib')); $hookmanager->initHooks(array('fileslib'));
@@ -84,17 +89,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
'loadsize' => $loadsize, 'loadsize' => $loadsize,
'mode' => $mode 'mode' => $mode
); );
$reshook=$hookmanager->executeHooks('getNodesList', $parameters, $object); $reshook=$hookmanager->executeHooks('getDirList', $parameters, $object);
} }
// $reshook may contain returns stacked by other modules
// $reshook is always empty with an array to not lose returns stacked with other modules
// $hookmanager->resArray may contain array stacked by other modules // $hookmanager->resArray may contain array stacked by other modules
if (! $nohook && ! empty($hookmanager->resArray)) // forced to use $hookmanager->resArray even if $hookmanager->resArray['nodes'] is empty if (empty($reshook))
{
return $hookmanager->resArray['nodes'];
}
else
{ {
if (! is_dir($newpath)) return array(); if (! is_dir($newpath)) return array();
@@ -102,7 +101,6 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
{ {
$filedate=''; $filedate='';
$filesize=''; $filesize='';
$file_list = array();
while (false !== ($file = readdir($dir))) // $file is always a basename (into directory $newpath) while (false !== ($file = readdir($dir))) // $file is always a basename (into directory $newpath)
{ {
@@ -195,14 +193,12 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
// Sort the data // Sort the data
if ($sortorder) array_multisort($myarray, $sortorder, $file_list); if ($sortorder) array_multisort($myarray, $sortorder, $file_list);
} }
}
}
$file_list = array_merge($file_list, $hookmanager->resArray);
return $file_list; return $file_list;
}
else
{
return array();
}
}
} }