diff options
Diffstat (limited to 'config/backup')
-rw-r--r-- | config/backup/backup.inc | 5 | ||||
-rw-r--r-- | config/backup/backup.tmp | 22 | ||||
-rw-r--r-- | config/backup/backup.xml | 2 |
3 files changed, 17 insertions, 12 deletions
diff --git a/config/backup/backup.inc b/config/backup/backup.inc index fa2783d6..b6adfbc9 100644 --- a/config/backup/backup.inc +++ b/config/backup/backup.inc @@ -95,6 +95,11 @@ function php_install_command() if (!is_dir('/usr/local/www/packages/backup/')) { exec("mkdir /usr/local/www/packages/backup/"); } + + //create the backup directory + if (!is_dir('/root/backup/')) { + exec("mkdir /root/backup/"); + } //rename PHP files from .tmp to .php exec("cp /tmp/backup.tmp /usr/local/www/packages/backup/backup.php"); diff --git a/config/backup/backup.tmp b/config/backup/backup.tmp index 546f9c3e..10e03db3 100644 --- a/config/backup/backup.tmp +++ b/config/backup/backup.tmp @@ -46,9 +46,9 @@ if ($_GET['act'] == "del") { if ($_GET['a'] == "download") { if ($_GET['t'] == "backup") { - $tmp = '/tmp/'; + $tmp = '/root/backup/'; $filename = 'pfsense.bak.tgz'; - //system('cd /usr/local/;tar cvzf /tmp/pfsense.bak.tgz freeswitch'); + //system('cd /usr/local/;tar cvzf /root/backup/pfsense.bak.tgz freeswitch'); $i = 0; if (count($a_backup) > 0) { @@ -79,13 +79,13 @@ if ($_GET['a'] == "download") { if ($_GET['a'] == "other") { if ($_GET['t'] == "restore") { - $tmp = '/tmp/'; + $tmp = '/root/backup/'; $filename = 'pfsense.bak.tgz'; //extract the tgz file - if (file_exists('/tmp/'.$filename)) { + if (file_exists('/root/backup/'.$filename)) { //echo "The file $filename exists"; - system('cd /; tar xvpfz /tmp/'.$filename.' '); + system('cd /; tar xvpfz /root/backup/'.$filename.' '); header( 'Location: backup.php?savemsg=Backup+has+been+restored.' ) ; } else { @@ -98,9 +98,9 @@ if ($_GET['a'] == "other") { if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { $filename = 'pfsense.bak.tgz'; - move_uploaded_file($_FILES['ulfile']['tmp_name'], "/tmp/" . $filename); - $savemsg = "Uploaded file to /tmp/" . htmlentities($_FILES['ulfile']['name']); - system('cd /; tar xvpfz /tmp/'.$filename.' '); + move_uploaded_file($_FILES['ulfile']['tmp_name'], "/root/backup/" . $filename); + $savemsg = "Uploaded file to /root/backup/" . htmlentities($_FILES['ulfile']['name']); + system('cd /; tar xvpfz /root/backup/'.$filename.' '); } @@ -183,13 +183,13 @@ if ($_GET["savemsg"]) { echo "<tr>\n"; echo "<td width='80%'>\n"; echo "<b>Backup / Restore</b><br />\n"; - echo "The 'backup' button will tar gzip the directories that are listed below to /tmp/pfsense.bak.tgz it then presents a file to download. \n"; - echo "If the backup file does not exist in /tmp/pfsense.bak.tgz then the 'restore' button will be hidden. \n"; + echo "The 'backup' button will tar gzip the directories that are listed below to /root/backup/pfsense.bak.tgz it then presents a file to download. \n"; + echo "If the backup file does not exist in /root/backup/pfsense.bak.tgz then the 'restore' button will be hidden. \n"; echo "<br /><br />\n"; echo "</td>\n"; echo "<td width='20%' valign='middle' align='right'>\n"; echo " <input type='button' value='backup' onclick=\"document.location.href='backup.php?a=download&t=backup';\" />\n"; - if (file_exists('/tmp/pfsense.bak.tgz')) { + if (file_exists('/root/backup/pfsense.bak.tgz')) { echo " <input type='button' value='restore' onclick=\"document.location.href='backup.php?a=other&t=restore';\" />\n"; } echo "</td>\n"; diff --git a/config/backup/backup.xml b/config/backup/backup.xml index a0f72ba2..b48a8e28 100644 --- a/config/backup/backup.xml +++ b/config/backup/backup.xml @@ -41,7 +41,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>Backup Settings</name> - <version>0.1.5</version> + <version>0.1.6</version> <title>Settings</title> <include_file>/usr/local/pkg/backup.inc</include_file> <menu> |