Commit 00d21d5c authored by Dries's avatar Dries

- Patch #28826 by chx: make xmlrpc_multicall working.

parent 78317bca
......@@ -120,9 +120,6 @@ function xmlrpc_message_parse(&$xmlrpc_message) {
xml_set_character_data_handler($xmlrpc_message->_parser, 'xmlrpc_message_cdata');
xmlrpc_message_set($xmlrpc_message);
if (!xml_parse($xmlrpc_message->_parser, $xmlrpc_message->message)) {
/* die(sprintf('XML error: %s at line %d',
xml_error_string(xml_get_error_code($xmlrpc_message->_parser)),
xml_get_current_line_number($xmlrpc_message->_parser))); */
return FALSE;
}
xml_parser_free($xmlrpc_message->_parser);
......@@ -392,22 +389,19 @@ function xmlrpc() {
* An array of calls. Each call is an array, where the first element
* is the method name, further elements are the arguments.
* @return
* An array of results.
*/
function xmlrpc_multicall() {
$args = func_get_args();
$url = $args[0];
$client = xmlrpc_client_multicall($url);
foreach ($args[1] as $call) {
$method = array_shift($call);
$calls[] = array(
'methodName' => $method,
'params' => $args
'params' => $call
);
}
$result = xmlrpc($url, 'system.multicall', $calls);
// $result = xmlrpc_client_multicall_query($client);
// $results[$method] = ($result === FALSE) ? xmlrpc_error() : $result;
// return $results;
return xmlrpc($url, 'system.multicall', $calls);
}
/**
......
......@@ -55,6 +55,7 @@ function xmlrpc_server($callbacks) {
if ($xmlrpc_server->message->messagetype != 'methodCall') {
xmlrpc_server_error(-32600, t('server error. invalid xml-rpc. not conforming to spec. Request must be a method_call'));
}
xmlrpc_server_set($xmlrpc_server);
$result = xmlrpc_server_call($xmlrpc_server, $xmlrpc_server->message->methodname, $xmlrpc_server->message->params);
// Is the result an error?
if ($result->is_error) {
......@@ -114,9 +115,10 @@ function xmlrpc_server_get() {
return xmlrpc_server_set();
}
function xmlrpc_server_multicall($xmlrpc_server, $methodcalls) {
function xmlrpc_server_multicall($methodcalls) {
// See http://www.xmlrpc.com/discuss/msgReader$1208
$return = array();
$xmlrpc_server = xmlrpc_server_get();
foreach ($methodcalls as $call) {
$method = $call['methodName'];
$params = $call['params'];
......@@ -131,7 +133,7 @@ function xmlrpc_server_multicall($xmlrpc_server, $methodcalls) {
'faultString' => $result->message
);
} else {
$return[] = array($result);
$return[] = $result;
}
}
return $return;
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment