diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-03-12 20:22:50 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-03-12 20:22:50 +0000 |
commit | 832f1b83da1c42a7873556fdfc8f0c4e9dab2a90 (patch) | |
tree | 423a438e27c348c5b006247011c0f73e79083a6a /etc | |
parent | 009c79057bc56709888c838361573d22a5eb13e5 (diff) | |
download | pfsense-832f1b83da1c42a7873556fdfc8f0c4e9dab2a90.zip pfsense-832f1b83da1c42a7873556fdfc8f0c4e9dab2a90.tar.gz |
Correctly backup and restore config sections.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 2ef5b9f..28f3cee 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -732,11 +732,14 @@ function is_service_running($service_name) { } /* - * backup_config_section($section): returns as an array the configuration section + * backup_config_section($section): returns as an xml file string of + * the configuration section */ function backup_config_section($section) { global $config; $new_section = &$config['section']; + /* generate configuration XML */ + $xmlconfig = dump_xml_config($new_section, $section); return $new_section; } @@ -749,7 +752,12 @@ function restore_config_section($section, $new_contents) { global $config; conf_mount_rw(); config_lock(); - $config[$section] = &$new_contents; + $fout = fopen("{$g['tmp_path']}/tmpxml","w"); + fwrite($fout, $current_rules_section); + fclose($fout); + $section_xml = parse_xml_config_pkg($g['tmp_path'] . "/tmpxml", "packagegui"); + $config[$section] = &$section_xml; + unlink($g['tmp_path'] . "/tmpxml"); write_config(); conf_mount_ro(); config_unlock(); |