Skip to content

Commit

Permalink
fix: corrected backup of content folder
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Jan 20, 2025
1 parent dd5ba7a commit b62cda1
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions phpmyfaq/src/phpMyFAQ/Administration/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b62cda1

Please sign in to comment.