From 95bd03465eab07d19d2ee1450620b357fd2e7516 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 12 Jun 2019 13:09:52 -0600 Subject: [PATCH] app/backup moved to fusionpbx-apps/backup Better to use the backup script but for those that still want it go to fusionpbx-apps repo to get it. --- app/backup/resources/classes/backup.php | 124 ------------------------ 1 file changed, 124 deletions(-) delete mode 100644 app/backup/resources/classes/backup.php diff --git a/app/backup/resources/classes/backup.php b/app/backup/resources/classes/backup.php deleted file mode 100644 index 59c464f1cd..0000000000 --- a/app/backup/resources/classes/backup.php +++ /dev/null @@ -1,124 +0,0 @@ - - Copyright (C) 2014 - All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -include "root.php"; - -//define the backup class - if (!class_exists('backup')) { - class backup { - public $result; - public $domain_uuid; - - public function command($type, $file) { - if ($type == "backup") { - $path = ($_SESSION['server']['backup']['path'] != '') ? $_SESSION['server']['backup']['path'] : '/tmp'; - $file = str_replace(array("/", "\\"),'',$file); //remove slashes to prevent changing the directory with the file name - $format = substr($file,-3); - if (strlen($file) == 3) { - $file = 'backup_'.date('Ymd_His').'.'.$format; - } - if (count($_SESSION['backup']['path']) > 0) { - //determine compression method - switch ($format) { - case "rar" : $cmd = 'rar a -ow -r '; break; - case "zip" : $cmd = 'zip -r '; break; - case "tbz" : $cmd = 'tar -jvcf '; break; - default : $cmd = 'tar -zvcf '; - } - $cmd .= $path.'/'.$file.' '; - foreach ($_SESSION['backup']['path'] as $value) { - $cmd .= $value.' '; - } - return $cmd; - } - else { - return false; - } - } - if ($type == "restore") { - $path = ($_SESSION['server']['backup']['path'] != '') ? $_SESSION['server']['backup']['path'] : '/tmp'; - $file = str_replace(array("/", "\\"),'',$file); //remove slashes to prevent changing the directory with the file name - $format = substr($file,-3); - if (count($_SESSION['backup']['path']) > 0) { - switch ($format) { - case "rar" : $cmd = 'rar x -ow -o+ '.$path.'/'.$file.' /'; break; - case "zip" : $cmd = 'umask 755; unzip -o -qq -X -K '.$path.'/'.$file.' -d /'; break; - case "tbz" : $cmd = 'tar -xvpjf '.$path.'/'.$file.' -C /'; break; - case "tgz" : $cmd = 'tar -xvpzf '.$path.'/'.$file.' -C /'; break; - default: $valid_format = false; - } - return $cmd; - } - else { - return false; - } - } - } - - public function backup($type, $format) { - $cmd = $this->command("backup", $format); - exec($cmd); - return $cmd; - } - - public function restore($file) { - $path = ($_SESSION['server']['backup']['path'] != '') ? $_SESSION['server']['backup']['path'] : '/tmp'; - $format = substr($file,-3); - switch ($format) { - case "rar" : break; - case "zip" : break; - case "tbz" : break; - case "tgz" : break; - default: return false; - } - $cmd = $this->command("restore", $file); - exec($cmd); - return $cmd; - } - - public function download($file) { - $path = ($_SESSION['server']['backup']['path'] != '') ? $_SESSION['server']['backup']['path'] : '/tmp'; - session_cache_limiter('public'); - $file = str_replace(array("/", "\\"),'',$file); //remove slashes to prevent changing the directory with the file name - if (file_exists($path."/".$file)) { - $fd = fopen($path."/".$file, 'rb'); - header("Content-Type: application/octet-stream"); - header("Content-Transfer-Encoding: binary"); - header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename='.$file); - header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 - header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past - header("Content-Length: ".filesize($path."/".$file)); - header("Pragma: no-cache"); - header("Expires: 0"); - ob_clean(); - fpassthru($fd); - exit; - } - } - } - } - -?> \ No newline at end of file