directory iterator wip

This commit is contained in:
Fred Tempez 2022-03-20 10:11:30 +01:00
parent 84b8ffffa9
commit 6f42bb480f

View File

@ -958,17 +958,23 @@ class theme extends common {
if ($zip->open(self::TEMP_DIR . $zipFilename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) === TRUE) { if ($zip->open(self::TEMP_DIR . $zipFilename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) === TRUE) {
switch ($modele) { switch ($modele) {
case 'admin': case 'admin':
$zip->addFile(self::DATA_DIR.'admin.json',self::DATA_DIR.'admin.json'); $zip->addFile(self::DATA_DIR.'admin.json');
$zip->addFile(self::DATA_DIR.'admin.css',self::DATA_DIR.'admin.css'); $zip->addFile(self::DATA_DIR.'admin.css');
// Ajoute les fontes // Ajoute les fontes
$zip->addEmptyDir(self::DATA_DIR .'fonts'); $zip->addEmptyDir(self::DATA_DIR .'fonts');
$pathdir = self::DATA_DIR .'fonts'; $path = realpath('site/data/fonts');
$dir = opendir(self::DATA_DIR .'fonts'); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $fileName)
while($file = readdir($dir)) { {
if(is_file($pathdir.$file)) { echo $fileName;
$zip -> addFile($pathdir.$file, $file); //var_dump($fileName !== $path . '/..' );
echo "<p>";
if ($fileName !== $path . '/.' || $fileName !== $path . '/..') {
$zip->addFile($fileName);
//echo $fileName;
//echo '<p>';
} }
} }
die();
break; break;
case 'theme': case 'theme':
$zip->addFile(self::DATA_DIR.'theme.json',self::DATA_DIR.'theme.json'); $zip->addFile(self::DATA_DIR.'theme.json',self::DATA_DIR.'theme.json');