Commit 7a39df6f authored by Ad Schellevis's avatar Ad Schellevis

(legacy) regression diag_confbak.php

parent f10e469b
...@@ -81,17 +81,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -81,17 +81,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
$cnf = OPNsense\Core\Config::getInstance(); $cnf = OPNsense\Core\Config::getInstance();
$confvers = $cnf->getBackups(true); $confvers = $cnf->getBackups(true);
if (!empty($_POST['backupcount'])) { if (!empty($_POST['save'])) {
if (is_numeric($_POST['backupcount']) && ($_POST['backupcount'] >= 0)) { if (is_numeric($_POST['backupcount']) && ($_POST['backupcount'] >= 0)) {
$config['system']['backupcount'] = $_POST['backupcount']; $config['system']['backupcount'] = $_POST['backupcount'];
} else { } elseif (isset($config['system']['backupcount'])) {
unset($config['system']['backupcount']); unset($config['system']['backupcount']);
} }
write_config(gettext('Changed backup revision count.')); write_config(gettext('Changed backup revision count.'));
} elseif (!empty($_POST['act']) && $_POST['act'] == "revert") { } elseif (!empty($_POST['act']) && $_POST['act'] == "revert") {
foreach ($confvers as $filename => $revision) { foreach ($confvers as $filename => $revision) {
if (isset($revision['time']) && $revision['time'] == $_POST['time']) { if (isset($revision['time']) && $revision['time'] == $_POST['time']) {
if (config_restore($filename)== 0) { if (config_restore($filename) == 0) {
$savemsg = sprintf(gettext('Successfully reverted to timestamp %s with description "%s".'), date(gettext("n/j/y H:i:s"), $_POST['id']), $revision['description']); $savemsg = sprintf(gettext('Successfully reverted to timestamp %s with description "%s".'), date(gettext("n/j/y H:i:s"), $_POST['id']), $revision['description']);
} else { } else {
$savemsg = gettext("Unable to revert to the selected configuration."); $savemsg = gettext("Unable to revert to the selected configuration.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment