mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add pfsense.merge_config_section which can merge two keys together via XMLRPC sync instead of killing the prior section. This is useful when merging subkeys of installedpackets for example.
This commit is contained in:
parent
339495c779
commit
83cda9769a
@ -1103,6 +1103,27 @@ function restore_config_section($section, $new_contents) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* merge_config_section($section, new_contents): restore a configuration section,
|
||||
* and write the configuration out
|
||||
* to disk/cf. But preserve the prior
|
||||
* structure if needed
|
||||
*/
|
||||
function merge_config_section($section, $new_contents) {
|
||||
global $config;
|
||||
conf_mount_rw();
|
||||
$fname = get_tmp_filename();
|
||||
$fout = fopen($fname, "w");
|
||||
fwrite($fout, $new_contents);
|
||||
fclose($fout);
|
||||
$section_xml = parse_xml_config($fname, $section);
|
||||
$config[$section] = $section_xml;
|
||||
unlink($fname);
|
||||
write_config("Restored {$section} of config file (maybe from CARP partner)");
|
||||
conf_mount_ro();
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* http_post($server, $port, $url, $vars): does an http post to a web server
|
||||
* posting the vars array.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user