* Add merge_installedpackages_section_xmlrpc() call used for merging

specific <installedpackages><AREANAME> sub items without replacing
  the entire <installedpackages> area with just this item
* Adjust TinyDNS sync to use this new method to avoid replacing the
  entire destination <installedpackages> area which also whipes
  out all other installd package information.
This commit is contained in:
Scott Ullrich 2008-02-14 04:27:56 +00:00
parent ac65e36e9f
commit cdcb273e5e

View File

@ -99,12 +99,36 @@ function restore_config_section_xmlrpc($raw_params) {
global $config, $xmlrpc_g;
$params = xmlrpc_params_to_php($raw_params);
if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail'];
$config = array_merge($config, $params[0]);
$mergedkeys = implode(",", array_keys($params[0]));
write_config("Merged in config ({$mergedkeys} sections) from XMLRPC client.");
return $xmlrpc_g['return']['true'];
}
/*****************************/
$merge_config_section_doc = 'XMLRPC wrapper for merging package sections. This method must be called with two parameters: a string containing the local system\'s password and an array to merge into the system\'s config. This function returns true upon completion.';
$merge_config_section_sig = array(
array(
$XML_RPC_Boolean,
$XML_RPC_String,
$XML_RPC_Struct
)
);
function merge_installedpackages_section_xmlrpc($raw_params) {
global $config, $xmlrpc_g;
$params = xmlrpc_params_to_php($raw_params);
if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail'];
$config['installedpackages'] = array_merge($config['installedpackages'], $params[0]);
$mergedkeys = implode(",", array_keys($params[0]));
write_config("Merged in config ({$mergedkeys} sections) from XMLRPC client.");
return $xmlrpc_g['return']['true'];
}
/*****************************/
@ -234,6 +258,9 @@ $server = new XML_RPC_Server(
'pfsense.merge_config_section' => array('function' => 'merge_config_section_xmlrpc',
'signature' => $merge_config_section_sig,
'docstring' => $merge_config_section_doc),
'pfsense.merge_installedpackages_section_xmlrpc' => array('function' => 'merge_installedpackages_section_xmlrpc',
'signature' => $merge_config_section_sig,
'docstring' => $merge_config_section_doc),
'pfsense.filter_configure' => array('function' => 'filter_configure_xmlrpc',
'signature' => $filter_configure_sig,
'docstring' => $filter_configure_doc),