= 0)) { $config['system']['backupcount'] = $_POST['backupcount']; $changedescr = $config['system']['backupcount']; } else { unset($config['system']['backupcount']); $changedescr = gettext("(platform default)"); } write_config(sprintf(gettext("Changed backup revision count to %s"), $changedescr)); } elseif ($_GET) { if (!isset($_GET['newver']) && !isset($_GET['rmver']) && !isset($_GET['getcfg']) && !isset($_GET['diff'])) { header("Location: diag_confbak.php"); return; } conf_mount_rw(); $confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache')); if ($_GET['newver'] != "") { if (config_restore($g['conf_path'] . '/backup/config-' . $_GET['newver'] . '.xml') == 0) { $savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['newver']), htmlspecialchars($confvers[$_GET['newver']]['description'])); } else { $savemsg = gettext("Unable to revert to the selected configuration."); } } if ($_GET['rmver'] != "") { unlink_if_exists($g['conf_path'] . '/backup/config-' . $_GET['rmver'] . '.xml'); $savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['rmver']), htmlspecialchars($confvers[$_GET['rmver']]['description'])); } conf_mount_ro(); } if ($_GET['getcfg'] != "") { $_GET['getcfg'] = basename($_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"), htmlspecialchars(gettext("Backup & Restore")), gettext("Config History")); include("head.inc"); if ($savemsg) { print_info_box($savemsg, 'success'); } $tab_array = array(); $tab_array[] = array(htmlspecialchars(gettext("Backup & Restore")), false, "diag_backup.php"); $tab_array[] = array(gettext("Config History"), true, "diag_confbak.php"); display_top_tabs($tab_array); if ($diff) { ?>

addInput(new Form_Input( 'backupcount', 'Backup Count', 'number', $config['system']['backupcount'] ))->setHelp('Maximum number of old configurations to keep. By default this is 30 for a full install or 5 on NanoBSD. '); $space = exec("/usr/bin/du -sh /conf/backup | /usr/bin/awk '{print $1;}'"); $section->addInput(new Form_StaticText( 'Current space used by backups', $space )); $form->add($section); print($form); if (is_array($confvers)) { ?>
" />
')">
" />