From ea71c3046de2ceb9427dab80755bee0db03938d5 Mon Sep 17 00:00:00 2001 From: David M Date: Sat, 15 Apr 2006 18:00:34 +0000 Subject: [PATCH] - Some archivers are worthless in this world git-svn-id: file:///svn/phpbb/trunk@5786 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_compress.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 2f3db3d343..700303fd7d 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -200,6 +200,26 @@ class compress_zip extends compress // This is a directory, we are not writting files continue; } + else + { + // Some archivers are punks, they don't don't include folders in their archives! + $str = ''; + $folders = explode('/', pathinfo($target_filename, PATHINFO_DIRNAME)); + + // Create and folders and subfolders if they do not exist + foreach ($folders as $folder) + { + $str = (!empty($str)) ? $str . '/' . $folder : $folder; + if (!is_dir($str)) + { + if (!@mkdir($str, 0777)) + { + trigger_error("Could not create directory $folder"); + } + @chmod($str, 0777); + } + } + } if (!$data['uc_size']) {