From b62cda109c024d31e2c0e4c6eee4c9c3a97ea8dc Mon Sep 17 00:00:00 2001 From: Thorsten Rinne Date: Mon, 20 Jan 2025 20:21:54 +0100 Subject: [PATCH] fix: corrected backup of content folder --- phpmyfaq/src/phpMyFAQ/Administration/Backup.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/phpmyfaq/src/phpMyFAQ/Administration/Backup.php b/phpmyfaq/src/phpMyFAQ/Administration/Backup.php index 849c09b237..15a6c7deb9 100644 --- a/phpmyfaq/src/phpMyFAQ/Administration/Backup.php +++ b/phpmyfaq/src/phpMyFAQ/Administration/Backup.php @@ -173,18 +173,16 @@ public function createContentFolderBackup(): string } $files = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator(PMF_CONTENT_DIR) + new RecursiveDirectoryIterator(PMF_CONTENT_DIR), + RecursiveIteratorIterator::LEAVES_ONLY ); foreach ($files as $file) { - $filePath = $file->getRealPath(); - $relativePath = substr($filePath, strlen(PMF_CONTENT_DIR) + 1); - - if ($file->isDir()) { - $zipArchive->addEmptyDir($relativePath); + if (!$file->isDir()) { + $filePath = $file->getRealPath(); + $relativePath = substr($filePath, strlen(PMF_CONTENT_DIR) + 1); + $zipArchive->addFile($filePath, $relativePath); } - - $zipArchive->addFile($filePath, $relativePath); } $zipArchive->close();