From 528cad397867e1ced7927d971ccfdb118313115a Mon Sep 17 00:00:00 2001 From: Colin Smith Date: Sat, 19 Feb 2005 23:16:20 +0000 Subject: Add option to exclude package configuration from backup. --- usr/local/www/diag_backup.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index 262ad6d..6231956 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -34,28 +34,35 @@ $omit_nocacheheaders = true; require("guiconfig.inc"); if ($_POST) { - unset($input_errors); - if (stristr($_POST['Submit'], "Restore")) $mode = "restore"; else if (stristr($_POST['Submit'], "Reinstall")) $mode = "reinstallpackages"; else if (stristr($_POST['Submit'], "Download")) $mode = "download"; + if ($_POST['Submit']["nopackages"]) + $options = "nopackages"; if ($mode) { if ($mode == "download") { config_lock(); - $fn = "config-" . $config['system']['hostname'] . "." . $config['system']['domain'] . "-" . date("YmdHis") . ".xml"; - + if($options == "nopackages") { + exec("sed '//,/<\/installedpackages>/d' /conf/config.xml > /tmp/config.xml.nopkg"); + $fs = filesize("/tmp/config.xml.nopkg"); + header("Content-Type: application/octet-stream"); + header("Content-Disposition: attachment; filename=$fn"); + header("Content-Length: $fs"); + readfile("/tmp/config.xml.nopkg"); + } else { $fs = filesize($g['conf_path'] . "/config.xml"); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=$fn"); header("Content-Length: $fs"); readfile($g['conf_path'] . "/config.xml"); + } config_unlock(); exit; } else if ($mode == "restore") { @@ -118,6 +125,7 @@ if ($_POST) {

Click this button to download the system configuration in XML format.

+ Do not backup package information.

-- cgit v1.1