summaryrefslogtreecommitdiff
path: root/includes/xmlrpc.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-08-17 15:01:14 +0000
committerDries Buytaert <dries@buytaert.net>2005-08-17 15:01:14 +0000
commitd6bcdafeedeb97e4c08586c518b0f27cb3a022db (patch)
tree00ea09233b432ce75b1fa6c66ca2c55bf87df05a /includes/xmlrpc.inc
parent05014a31353af85cb549a87c03604114eac9b13c (diff)
downloadbrdo-d6bcdafeedeb97e4c08586c518b0f27cb3a022db.tar.gz
brdo-d6bcdafeedeb97e4c08586c518b0f27cb3a022db.tar.bz2
- Patch #7458 by chx: merged the XML-RPC multicall support into xmlrpc() and use lazy-loading for the XML-RPC libraries.(performance improvement).
Diffstat (limited to 'includes/xmlrpc.inc')
-rw-r--r--includes/xmlrpc.inc52
1 files changed, 12 insertions, 40 deletions
diff --git a/includes/xmlrpc.inc b/includes/xmlrpc.inc
index 655fe996d..0f183bcf8 100644
--- a/includes/xmlrpc.inc
+++ b/includes/xmlrpc.inc
@@ -340,25 +340,21 @@ function xmlrpc_base64_get_xml($xmlrpc_base64) {
return '<base64>'. base64_encode($xmlrpc_base64->data) .'</base64>';
}
-/**
- * Perform an XML-RPC request.
- *
- * @param $url
- * An absolute URL of the XML-RPC server
- * @param $method
- * The method to be executed
- * @param ...
- * A variable number of arguments of the method.
- * @return
- * The return value of the method on success or FALSE. On FALSE, see
- * xmlrpc_errno() and xmlrpc_error_msg().
- */
-function xmlrpc() {
+function _xmlrpc() {
$args = func_get_args();
$url = array_shift($args);
- $method = array_shift($args);
+ if (is_array($args[0])) {
+ $method = 'system.multicall';
+ $multicall_args = array();
+ foreach ($args[0] as $call) {
+ $multicall_args[] = array('methodName' => array_shift($call),'params' => $call);
+ }
+ $args = array($multicall_args);
+ }
+ else {
+ $method = array_shift($args);
+ }
$xmlrpc_request = xmlrpc_request($method, $args);
-// $request .= "Content-Type: text/xml$r";
$result = drupal_http_request($url, array("Content-Type" => "text/xml"), 'POST', $xmlrpc_request->xml);
if ($result->code != 200) {
xmlrpc_error(-$result->code, $result->error);
@@ -381,30 +377,6 @@ function xmlrpc() {
}
/**
- * Perform multiple calls in one request if possible.
- *
- * @param $url
- * An absolute URL of the XML-RPC server
- * @param $calls
- * 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];
- foreach ($args[1] as $call) {
- $method = array_shift($call);
- $calls[] = array(
- 'methodName' => $method,
- 'params' => $call
- );
- }
- return xmlrpc($url, 'system.multicall', $calls);
-}
-
-/**
* Returns the last XML-RPC client error number
*/
function xmlrpc_errno() {