|
|
|
@ -84,35 +84,38 @@ class CacheRepertoire {
|
|
|
|
|
// $dir/{champ}/{identifiant_fichier}/{nom du fichier.extension}
|
|
|
|
|
$directory = $this->dir;
|
|
|
|
|
|
|
|
|
|
// pas de répertoire… pas de fichier… simple comme bonjour :)
|
|
|
|
|
if (!is_dir($directory)) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$liste = [];
|
|
|
|
|
|
|
|
|
|
$files = new \RecursiveIteratorIterator(
|
|
|
|
|
new \RecursiveDirectoryIterator($directory)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
foreach ($files as $filename) {
|
|
|
|
|
if (
|
|
|
|
|
$filename->isDir()
|
|
|
|
|
or $filename->getFilename()[0] == '.' // .ok
|
|
|
|
|
or CacheFichiers::est_fichier_description($filename)
|
|
|
|
|
) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
$files = new \RecursiveIteratorIterator(
|
|
|
|
|
new \RecursiveDirectoryIterator($directory)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$files->rewind();
|
|
|
|
|
while ($files->valid()) {
|
|
|
|
|
$filename = $files->current();
|
|
|
|
|
if (
|
|
|
|
|
$filename->isDir()
|
|
|
|
|
or $filename->getFilename()[0] == '.' // .ok
|
|
|
|
|
or CacheFichiers::est_fichier_description($filename)
|
|
|
|
|
) {
|
|
|
|
|
$files->next();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$chemin = $filename->getPathname();
|
|
|
|
|
if ($description = CacheFichiers::obtenir_description_fichier($chemin)) {
|
|
|
|
|
$champ = $description['bigup']['champ'];
|
|
|
|
|
$chemin = $filename->getPathname();
|
|
|
|
|
if ($description = CacheFichiers::obtenir_description_fichier($chemin)) {
|
|
|
|
|
$champ = $description['bigup']['champ'];
|
|
|
|
|
|
|
|
|
|
if (empty($liste[$champ])) {
|
|
|
|
|
$liste[$champ] = [];
|
|
|
|
|
if (empty($liste[$champ])) {
|
|
|
|
|
$liste[$champ] = [];
|
|
|
|
|
}
|
|
|
|
|
$liste[$champ][] = $description;
|
|
|
|
|
}
|
|
|
|
|
$liste[$champ][] = $description;
|
|
|
|
|
$files->next();
|
|
|
|
|
}
|
|
|
|
|
} catch (\UnexpectedValueException $e) {
|
|
|
|
|
return $liste;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $liste;
|
|
|
|
|