From 8ac3b92248beb6cedbdd686a6b8c328a554275ff Mon Sep 17 00:00:00 2001 From: metal_gvc Date: Thu, 13 Feb 2014 21:22:37 +0200 Subject: [PATCH] Restore Site from Backup - backup all except plugins/box #228 --- libraries/Gelato/Zip/Zip.php | 6 +++--- plugins/box/backup/backup.admin.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/Gelato/Zip/Zip.php b/libraries/Gelato/Zip/Zip.php index 36fb9a0..0198111 100644 --- a/libraries/Gelato/Zip/Zip.php +++ b/libraries/Gelato/Zip/Zip.php @@ -270,7 +270,7 @@ class Zip * @param string $root_path Root path * @return mixed */ - public function readDir($path, $preserve_filepath = true, $root_path = null) + public function readDir($path, $preserve_filepath = true, $root_path = null, $exclude_files = array()) { if ( ! $fp = @opendir($path)) { return false; @@ -283,12 +283,12 @@ class Zip while (false !== ($file = readdir($fp))) { - if (substr($file, 0, 1) == '.') { + if (substr($file, 0, 1) == '.' || in_array($path.$file, $exclude_files)) { continue; } if (@is_dir($path.$file)) { - $this->readDir($path.$file."/", $preserve_filepath, $root_path); + $this->readDir($path.$file."/", $preserve_filepath, $root_path, $exclude_files); } else { if (false !== ($data = file_get_contents($path.$file))) { $name = str_replace("\\", "/", $path); diff --git a/plugins/box/backup/backup.admin.php b/plugins/box/backup/backup.admin.php index 20253d5..aa9478b 100755 --- a/plugins/box/backup/backup.admin.php +++ b/plugins/box/backup/backup.admin.php @@ -30,10 +30,10 @@ class BackupAdmin extends Backend $zip->readDir(STORAGE . DS, false); // Add public folder - if (Request::post('add_public_folder')) $zip->readDir(ROOT . DS . 'public' . DS, false); + $zip->readDir(ROOT . DS . 'public' . DS, false); // Add plugins folder - if (Request::post('add_plugins_folder')) $zip->readDir(PLUGINS . DS, false); + $zip->readDir(PLUGINS . DS, false, null, array(PLUGINS . DS . 'box')); if ($zip->archive($backups_path . DS . Date::format(time(), "Y-m-d-H-i-s").'.zip')) { Notification::set('success', __('Backup was created', 'backup'));