diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-01-28 22:56:55 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-01-28 22:56:55 +0000 |
commit | 8ccc8f1a84373d06475dacb53e7079212e616710 (patch) | |
tree | bd7378e3037e2402db7708d3cac9ab249bce6f7c /usr/local/www/diag_backup.php | |
parent | 5ba188972546226daf9285d95ea9fe0cdede10ef (diff) | |
download | pfsense-8ccc8f1a84373d06475dacb53e7079212e616710.zip pfsense-8ccc8f1a84373d06475dacb53e7079212e616710.tar.gz |
Add package reinstallation button to Backup/Restore area. The script will basically reinstall any packages needed by your configuration after a restore ;)
Diffstat (limited to 'usr/local/www/diag_backup.php')
-rwxr-xr-x | usr/local/www/diag_backup.php | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index ef40607..de8917a 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -1,22 +1,22 @@ #!/usr/local/bin/php -<?php +<?php /* diag_backup.php part of m0n0wall (http://m0n0.ch/wall) - + Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -31,26 +31,28 @@ /* omit no-cache headers because it confuses IE with file downloads */ $omit_nocacheheaders = true; -require("guiconfig.inc"); +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 ($mode) { if ($mode == "download") { config_lock(); - - $fn = "config-" . $config['system']['hostname'] . "." . + + $fn = "config-" . $config['system']['hostname'] . "." . $config['system']['domain'] . "-" . date("YmdHis") . ".xml"; - + $fs = filesize($g['conf_path'] . "/config.xml"); - header("Content-Type: application/octet-stream"); + header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=$fn"); header("Content-Length: $fs"); readfile($g['conf_path'] . "/config.xml"); @@ -67,6 +69,9 @@ if ($_POST) { } else { $input_errors[] = "The configuration could not be restored (file upload error)."; } + } else if ($mode == "reinstallpackages") { + header("Location: pkg_mgr_install.php?mode=reinstallall"); + exit; } } } @@ -86,27 +91,27 @@ if ($_POST) { <?php if ($input_errors) print_input_errors($input_errors); ?> <?php if ($savemsg) print_info_box($savemsg); ?> <table width="100%" border="0" cellspacing="0" cellpadding="6"> - <tr> + <tr> <td colspan="2" class="listtopic">Backup configuration</td> </tr> - <tr> + <tr> <td width="22%" valign="baseline" class="vncell"> </td> - <td width="78%" class="vtable"> - <p> Click this button to download the system configuration + <td width="78%" class="vtable"> + <p> Click this button to download the system configuration in XML format.<br> <br> <input name="Submit" type="submit" class="formbtn" id="download" value="Download configuration"></td> </tr> - <tr> + <tr> <td colspan="2" class="list" height="12"></td> </tr> - <tr> + <tr> <td colspan="2" class="listtopic">Restore configuration</td> </tr> - <tr> + <tr> <td width="22%" valign="baseline" class="vncell"> </td> - <td width="78%" class="vtable"> - Open a pfSense configuration XML file and click the button + <td width="78%" class="vtable"> + Open a pfSense configuration XML file and click the button below to restore the configuration.<br> <br> <strong><span class="red">Note:</span></strong><br> @@ -118,6 +123,19 @@ if ($_POST) { <input name="Submit" type="submit" class="formbtn" id="restore" value="Restore configuration"> </td> </tr> + <tr> + <td colspan="2"> </td> + </tr> + <tr> + <td colspan="2" class="listtopic">Reinstall packages</td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> Click this button to reinstall all system packages. This may wake a while.<br> + <br> + <input name="Submit" type="submit" class="formbtn" id="reinstallpackages" value="Reinstall packages"></td> + </tr> </table> </form> <?php include("fend.inc"); ?> |