From 79d0fd28b0b77fea610f45d991e1a5847e48b37e Mon Sep 17 00:00:00 2001 From: johnnyq Date: Thu, 19 Jun 2025 00:17:52 -0400 Subject: [PATCH] Fix Backup function --- post/admin/admin_backup.php | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/post/admin/admin_backup.php b/post/admin/admin_backup.php index fa3b5187..e98c6b73 100644 --- a/post/admin/admin_backup.php +++ b/post/admin/admin_backup.php @@ -8,44 +8,9 @@ defined('FROM_POST_HANDLER') || die("Direct file access is not allowed"); require_once "includes/app_version.php"; -if (!function_exists('zipFolder')) { - function zipFolder($folderPath, $zipFilePath) { - $zip = new ZipArchive(); - if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== TRUE) { - error_log("Failed to open zip file: $zipFilePath"); - http_response_code(500); - exit("Internal Server Error: Cannot open zip archive."); - } - - $folderPath = realpath($folderPath); - if (!$folderPath) { - error_log("Invalid folder path: $folderPath"); - http_response_code(500); - exit("Internal Server Error: Invalid folder path."); - } - - $files = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($folderPath), - RecursiveIteratorIterator::LEAVES_ONLY - ); - - foreach ($files as $file) { - if (!$file->isDir()) { - $filePath = $file->getRealPath(); - $relativePath = substr($filePath, strlen($folderPath) + 1); - $zip->addFile($filePath, $relativePath); - } - } - - $zip->close(); - } -} - -