PMCORE-618
This commit is contained in:
@@ -332,21 +332,26 @@ class AuditLog
|
|||||||
*/
|
*/
|
||||||
private function getFiles($path, $pattern = '', $dir = 'ASC')
|
private function getFiles($path, $pattern = '', $dir = 'ASC')
|
||||||
{
|
{
|
||||||
$finder = new Finder();
|
try {
|
||||||
$finder->files()
|
$finder = new Finder();
|
||||||
->in($path)
|
$finder->files()
|
||||||
->name($pattern);
|
->in($path)
|
||||||
$files = iterator_to_array($finder->getIterator());
|
->name($pattern);
|
||||||
uasort($files, function ($a, $b) use ($dir) {
|
$files = iterator_to_array($finder->getIterator());
|
||||||
$name1 = $a->getFilename();
|
uasort($files, function ($a, $b) use ($dir) {
|
||||||
$name2 = $b->getFilename();
|
$name1 = $a->getFilename();
|
||||||
if ($dir === 'ASC') {
|
$name2 = $b->getFilename();
|
||||||
return strcmp($name1, $name2);
|
if ($dir === 'ASC') {
|
||||||
} else {
|
return strcmp($name1, $name2);
|
||||||
return strcmp($name2, $name1);
|
} else {
|
||||||
}
|
return strcmp($name2, $name1);
|
||||||
});
|
}
|
||||||
return $files;
|
});
|
||||||
|
return $files;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Return array empty when the path does not exist
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user