summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_firmware_restorefullbackup.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-05-30 17:11:24 +0545
committerPhil Davis <phil.davis@inf.org>2015-05-30 17:11:24 +0545
commit0e88de0c3bd7736f6dd949063270b18ef84b5274 (patch)
treef54120190540a7ff70c4d91d5f1f344c24fbc6a4 /usr/local/www/system_firmware_restorefullbackup.php
parent5dcec9f242a94894086dd425ecf9d2f00ccdebd5 (diff)
downloadpfsense-0e88de0c3bd7736f6dd949063270b18ef84b5274.zip
pfsense-0e88de0c3bd7736f6dd949063270b18ef84b5274.tar.gz
Code style system firmware
Diffstat (limited to 'usr/local/www/system_firmware_restorefullbackup.php')
-rw-r--r--usr/local/www/system_firmware_restorefullbackup.php32
1 files changed, 18 insertions, 14 deletions
diff --git a/usr/local/www/system_firmware_restorefullbackup.php b/usr/local/www/system_firmware_restorefullbackup.php
index b31d096..b062312 100644
--- a/usr/local/www/system_firmware_restorefullbackup.php
+++ b/usr/local/www/system_firmware_restorefullbackup.php
@@ -53,16 +53,18 @@ require("guiconfig.inc");
require_once("filter.inc");
require_once("shaper.inc");
-if($_POST['overwriteconfigxml'])
+if ($_POST['overwriteconfigxml']) {
touch("/tmp/do_not_restore_config.xml");
+}
-if($_GET['backupnow'])
+if ($_GET['backupnow']) {
mwexec_bg("/etc/rc.create_full_backup");
+}
-if($_GET['downloadbackup']) {
+if ($_GET['downloadbackup']) {
$filename = basename($_GET['downloadbackup']);
$path = "/root/{$filename}";
- if(file_exists($path)) {
+ if (file_exists($path)) {
session_write_close();
ob_end_clean();
session_cache_limiter('public');
@@ -71,11 +73,11 @@ if($_GET['downloadbackup']) {
header("Cache-Control: ");
header("Pragma: ");
header("Content-Type: application/octet-stream");
- header("Content-Length: " .(string)(filesize($path)) );
+ header("Content-Length: " .(string)(filesize($path)));
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
- if($file = fopen("/root/{$filename}", 'rb')){
- while( (!feof($file)) && (connection_status()==0) ){
+ if ($file = fopen("/root/{$filename}", 'rb')) {
+ while ((!feof($file)) && (connection_status() == 0)) {
print(fread($file, 1024*8));
flush();
}
@@ -88,7 +90,7 @@ if($_GET['downloadbackup']) {
if ($_GET['deletefile']) {
$filename = basename($_GET['deletefile']);
- if(file_exists("/root/{$filename}") && (preg_match("/pfSense-full-backup-\d+-\d+\.tgz/", $filename) == 1)) {
+ if (file_exists("/root/{$filename}") && (preg_match("/pfSense-full-backup-\d+-\d+\.tgz/", $filename) == 1)) {
unlink("/root/" . $filename);
$savemsg = htmlspecialchars($filename) . " " . gettext("has been deleted.");
} else {
@@ -98,7 +100,7 @@ if ($_GET['deletefile']) {
if ($_POST['restorefile']) {
$filename = basename($_POST['restorefile']);
- if(file_exists("/root/{$filename}") && (preg_match("/pfSense-full-backup-\d+-\d+\.tgz/", $filename) == 1)) {
+ if (file_exists("/root/{$filename}") && (preg_match("/pfSense-full-backup-\d+-\d+\.tgz/", $filename) == 1)) {
mwexec_bg("/etc/rc.restore_full_backup /root/" . escapeshellcmd($filename));
$savemsg = gettext("The firewall is currently restoring") . " " . htmlspecialchars($filename);
} else {
@@ -106,7 +108,7 @@ if ($_POST['restorefile']) {
}
}
-$pgtitle = array(gettext("Diagnostics"),gettext("Restore full backup"));
+$pgtitle = array(gettext("Diagnostics"), gettext("Restore full backup"));
include("head.inc");
?>
@@ -130,8 +132,9 @@ include("head.inc");
$tab_array[] = array(gettext("Manual Update"), false, "system_firmware.php");
$tab_array[] = array(gettext("Auto Update"), false, "system_firmware_check.php");
$tab_array[] = array(gettext("Updater Settings"), false, "system_firmware_settings.php");
- if($g['hidedownloadbackup'] == false)
+ if ($g['hidedownloadbackup'] == false) {
$tab_array[] = array(gettext("Restore Full Backup"), true, "system_firmware_restorefullbackup.php");
+ }
display_top_tabs($tab_array);
?>
</td>
@@ -150,7 +153,7 @@ include("head.inc");
chdir("/root");
$available_restore_files = glob("pfSense-full-backup-*");
$counter = 0;
- foreach($available_restore_files as $arf) {
+ foreach ($available_restore_files as $arf) {
$counter++;
$size = exec("gzip -l /root/$arf | grep -v compressed | awk '{ print $2 }'");
echo "<tr>";
@@ -173,7 +176,7 @@ include("head.inc");
echo "</td>";
echo "</tr>";
}
- if($counter == 0) {
+ if ($counter == 0) {
echo "<tr>";
echo "<td class='listlr' width='100%' colspan='4' align='center'>";
echo gettext("Could not locate any previous backups.");
@@ -208,7 +211,8 @@ decrypt_change();
</html>
<?php
-if (is_subsystem_dirty('restore'))
+if (is_subsystem_dirty('restore')) {
system_reboot();
+}
?>
OpenPOWER on IntegriCloud