diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-04-21 20:02:57 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-04-21 20:02:57 +0000 |
commit | d75c7f7e7476f0e166537e49a70aa446ed391251 (patch) | |
tree | 3a09e8403bbb505892edcb4528aeaa8f33ba7fb8 /etc/inc/config.inc | |
parent | d09d9e45bef20ee63ebec755e5a90bc3d4e1fee4 (diff) | |
download | pfsense-d75c7f7e7476f0e166537e49a70aa446ed391251.zip pfsense-d75c7f7e7476f0e166537e49a70aa446ed391251.tar.gz |
xmlparse now returns -1 when a file is corrupt. Detect this situation during parse_config() and trigger a backup. Note to the user this occurance.
Diffstat (limited to 'etc/inc/config.inc')
-rw-r--r-- | etc/inc/config.inc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index 6bdfc36..a81a3d8 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -238,6 +238,13 @@ function parse_config($parse = false) { log_error("Could not restore config.xml."); } $config = parse_xml_config($g['conf_path'] . '/config.xml', $g['xml_rootobj']); + if($config == "-1") { + $last_backup = discover_last_backup(); + if ($last_backup) + restore_backup("/cf/conf/backup/{$last_backup}"); + else + log_error(gettext("Could not restore config.xml.")); + } generate_config_cache($config); } if($g['booting']) echo "."; @@ -293,6 +300,7 @@ function restore_backup($file) { if(file_exists($file)) { conf_mount_rw(); system("cp $file /cf/conf/config.xml"); + log_error("pfSense is restoring the configuration $file"); } } |