diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-03-12 19:02:13 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-03-12 19:02:13 +0000 |
commit | f8891a0f1413491c6ba3969f6074e6f61e41664c (patch) | |
tree | 95ff9b2c7391129d33e3cde9d186ab4e25ed2d89 | |
parent | 8840eb5fad3f8fdc062e252c4aff7b0ba4092a12 (diff) | |
download | pfsense-f8891a0f1413491c6ba3969f6074e6f61e41664c.zip pfsense-f8891a0f1413491c6ba3969f6074e6f61e41664c.tar.gz |
* Add backup_config_section which returns as an array a portion of the xml configuration.
* Add restore_config_section which accepts a config array and will write out the overwritten section
-rw-r--r-- | etc/inc/pfsense-utils.inc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 5253e09..c7b3a01 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -730,4 +730,31 @@ function is_service_running($service_name) { if($counter > 0) return 1; return 0; } + +/* + * backup_config_section($section): returns as an array the configuration section + */ +function backup_config_section($section) { + global $config; + $new_section = &$config['section']; + return $new_section; +} + +/* + * restore_config_section($section, new_contents): restore a configuration section, + * and write the configuration out + * to disk/cf. + */ +function restore_config_section($section, $new_contents) { + global $config; + conf_mount_rw(); + config_lock(); + &$config[$section] = $new_contents; + write_config(); + conf_mount_ro(); + config_unlock(); + return; +} + + ?> |