= 0)) {
$config['system']['backupcount'] = $_POST['backupcount'];
$changedescr = $config['system']['backupcount'];
} else {
unset($config['system']['backupcount']);
$changedescr = "(platform default)";
}
write_config("Changed backup revision count to {$changedescr}");
} elseif ($_POST) {
if (!isset($_POST['confirm']) || ($_POST['confirm'] != gettext("Confirm")) || (!isset($_POST['newver']) && !isset($_POST['rmver']))) {
header("Location: diag_confbak.php");
return;
}
conf_mount_rw();
$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
if($_POST['newver'] != "") {
if(config_restore($g['conf_path'] . '/backup/config-' . $_POST['newver'] . '.xml') == 0)
$savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $confvers[$_POST['newver']]['description']);
else
$savemsg = gettext("Unable to revert to the selected configuration.");
}
if($_POST['rmver'] != "") {
unlink_if_exists($g['conf_path'] . '/backup/config-' . $_POST['rmver'] . '.xml');
$savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['rmver']),$confvers[$_POST['rmver']]['description']);
}
conf_mount_ro();
}
if($_GET['getcfg'] != "") {
$file = $g['conf_path'] . '/backup/config-' . $_GET['getcfg'] . '.xml';
$exp_name = urlencode("config-{$config['system']['hostname']}.{$config['system']['domain']}-{$_GET['getcfg']}.xml");
$exp_data = file_get_contents($file);
$exp_size = strlen($exp_data);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$exp_name}");
header("Content-Length: $exp_size");
echo $exp_data;
exit;
}
if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime'])
&& is_numeric($_GET['oldtime']) && (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) {
$diff = "";
$oldfile = $g['conf_path'] . '/backup/config-' . $_GET['oldtime'] . '.xml';
$oldtime = $_GET['oldtime'];
if ($_GET['newtime'] == 'current') {
$newfile = $g['conf_path'] . '/config.xml';
$newtime = $config['revision']['time'];
} else {
$newfile = $g['conf_path'] . '/backup/config-' . $_GET['newtime'] . '.xml';
$newtime = $_GET['newtime'];
}
if (file_exists($oldfile) && file_exists($newfile)) {
exec("/usr/bin/diff -u " . escapeshellarg($oldfile) . " " . escapeshellarg($newfile), $diff);
}
}
cleanup_backupcache(false);
$confvers = get_backups();
unset($confvers['versions']);
$pgtitle = array(gettext("Diagnostics"),gettext("Configuration History"));
include("head.inc");
?>
=gettext("Configuration diff from");?> =gettext("to");?> |
|