1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-04 04:07:59 +02:00

Restore Site from Backup - backup all except plugins/box #228

This commit is contained in:
metal_gvc
2014-02-13 21:22:37 +02:00
parent 37ec41199d
commit 8ac3b92248
2 changed files with 5 additions and 5 deletions

View File

@@ -270,7 +270,7 @@ class Zip
* @param string $root_path Root path * @param string $root_path Root path
* @return mixed * @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)) { if ( ! $fp = @opendir($path)) {
return false; return false;
@@ -283,12 +283,12 @@ class Zip
while (false !== ($file = readdir($fp))) { while (false !== ($file = readdir($fp))) {
if (substr($file, 0, 1) == '.') { if (substr($file, 0, 1) == '.' || in_array($path.$file, $exclude_files)) {
continue; continue;
} }
if (@is_dir($path.$file)) { if (@is_dir($path.$file)) {
$this->readDir($path.$file."/", $preserve_filepath, $root_path); $this->readDir($path.$file."/", $preserve_filepath, $root_path, $exclude_files);
} else { } else {
if (false !== ($data = file_get_contents($path.$file))) { if (false !== ($data = file_get_contents($path.$file))) {
$name = str_replace("\\", "/", $path); $name = str_replace("\\", "/", $path);

View File

@@ -30,10 +30,10 @@ class BackupAdmin extends Backend
$zip->readDir(STORAGE . DS, false); $zip->readDir(STORAGE . DS, false);
// Add public folder // 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 // 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')) { if ($zip->archive($backups_path . DS . Date::format(time(), "Y-m-d-H-i-s").'.zip')) {
Notification::set('success', __('Backup was created', 'backup')); Notification::set('success', __('Backup was created', 'backup'));