summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Marquette <billm@pfsense.org>2005-05-16 00:35:42 +0000
committerBill Marquette <billm@pfsense.org>2005-05-16 00:35:42 +0000
commit32f11c0559c2c6f5c16789203fedd54750e21a04 (patch)
tree64533afe93521b545dcbd7215a612ddc0539f803
parent734edbdf0490506a041a7e9470d4c99566028b5d (diff)
downloadpfsense-32f11c0559c2c6f5c16789203fedd54750e21a04.zip
pfsense-32f11c0559c2c6f5c16789203fedd54750e21a04.tar.gz
Make config backup actually work
-rw-r--r--etc/inc/config.inc2
-rwxr-xr-xusr/local/www/diag_confbak.php9
2 files changed, 5 insertions, 6 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index 9640f7f..a0001dd 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -1000,7 +1000,7 @@ function backup_config() {
} else {
$backupcache = array();
}
- $backupcache[$baktime] = array('description' => $bakdesc);
+ $backupcache[] = array('time' => $baktime, 'description' => $bakdesc);
$bakout = fopen($g['cf_conf_path'] . '/backup/backup.cache', "w");
fwrite($bakout, serialize($backupcache));
fclose($bakout);
diff --git a/usr/local/www/diag_confbak.php b/usr/local/www/diag_confbak.php
index 8b0ab69..3c7eccc 100755
--- a/usr/local/www/diag_confbak.php
+++ b/usr/local/www/diag_confbak.php
@@ -55,7 +55,7 @@ include("fbegin.inc");
<td class="tabcont">
<?php
if(file_exists("/conf/backup/backup.cache")) {
- $confvers = array_reverse(file("/conf/backup/backup.cache"));
+ $confvers = unserialize(file_get_contents("/cf/conf/backup/backup.cache"));
array_unshift($confvers, $confvers[0]);
} else {
print_info_box("No backups found.");
@@ -71,7 +71,6 @@ if(is_array($confvers)) { ?>
$curconfigs = array();
$i = 0;
foreach($confvers as $version) {
- $version = trim($version);
$changes = array();
if($version == $config['revision']['time'] and $i == 0) {
$i++;
@@ -79,9 +78,9 @@ if(is_array($confvers)) { ?>
$changes['time'] = $version;
$changes['date'] = "Current";
} else { // Use backup.cache to find the next usable backup.
- if(file_exists("/conf/backup/config-{$version}.xml")) {
- $curconfigs[] = file_get_contents("/conf/backup/config-{$version}.xml");
- $curconfig = parse_xml_config("/conf/backup/config-{$version}.xml", $g['xml_rootobj']);
+ if(file_exists("/conf/backup/config-{$version['time']}.xml")) {
+ $curconfigs[] = file_get_contents("/conf/backup/config-{$version['time']}.xml");
+ $curconfig = parse_xml_config("/conf/backup/config-{$version['time']}.xml", $g['xml_rootobj']);
if(file_exists("/conf/backup/config-{$curconfig['revision']['time']}.xml")) {
$changes['time'] = $curconfig['revision']['time'];
$changes['date'] = date("n/j H:i:s", $changes['time']);
OpenPOWER on IntegriCloud