From 7cf03119e526310e4ac09a7748346e58bdd87561 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Sun, 20 Mar 2005 04:42:55 +0000 Subject: breath life into the restore config code --- usr/local/www/diag_backup.php | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index 862ebcf..d1c32ec 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -35,15 +35,21 @@ require("guiconfig.inc"); if ($_POST) { unset($input_errors); - if (stristr($_POST['Submit'], "Restore")) + if (stristr($_POST['Submit'], "Restore configuration")) $mode = "restore"; else if (stristr($_POST['Submit'], "Reinstall")) $mode = "reinstallpackages"; else if (stristr($_POST['Submit'], "Download")) $mode = "download"; + else if (stristr($_POST['Submit'], "Restore version")) + $mode = "restore_ver"; + if ($_POST["nopackages"] <> "") $options = "nopackages"; + if ($_POST["ver"] <> "") + $ver2restore = $_POST["ver"]; + if ($mode) { if ($mode == "download") { config_lock(); @@ -97,13 +103,26 @@ if ($_POST) { } else if ($mode == "reinstallpackages") { header("Location: pkg_mgr_install.php?mode=reinstallall"); exit; + } else if ($mode == "restore_ver") { + $input_errors[] = "XXX - this feature is not yet functional - billm"; + $input_errors[] = "XXX - this feature may hose your config (do NOT backrev configs!) - billm"; + if ($ver2restore <> "") { + $conf_file = "{$g['cf_conf_path']}/bak/config-" . strtotime($ver2restore) . ".xml"; + if (config_install($conf_file) == 0) { + system_reboot(); + $savemsg = "The configuration has been restored. The firewall is now rebooting."; + } else { + $input_errors[] = "The configuration could not be restored."; + } + } else { + $input_errors[] = "No version selected."; + } } } } /* XXX - billm: begginnings of version control code - * This code sucks and is really more of a PoC - it needs cleanup (and doesn't work) * don't set system/version_control :) */ if (isset($config['system']['version_control'])) { @@ -203,11 +222,15 @@ if (isset($config['system']['version_control'])) { - - - + + + + + + + -- cgit v1.1