1: <?php
2: /**
3: * ManiaLive - TrackMania dedicated server manager in PHP
4: * Based on
5: * GbxRemote by Nadeo and
6: * IXR - The Incutio XML-RPC Library - (c) Incutio Ltd 2002
7: *
8: * @copyright Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
9: * @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
10: * @version $Revision: 425 $:
11: * @author $Author: melot.philippe $:
12: * @date $Date: 2012-07-18 12:36:36 +0200 (mer., 18 juil. 2012) $:
13: */
14:
15: // TODO XMLRPCLib: remettre les credits
16:
17: namespace DedicatedApi\Xmlrpc;
18:
19: if (!defined('LF')) define('LF', "\n");
20:
21: class ClientMulticall extends Client
22: {
23: public $calls = array();
24:
25: function addCall($methodName, $args)
26: {
27: $struct = array('methodName' => $methodName, 'params' => $args);
28: $this->calls[] = $struct;
29:
30: return (count($this->calls) - 1);
31: }
32:
33: function multiquery()
34: {
35: $result = array();
36: if(count($this->calls))
37: {
38: $result = parent::query('system.multicall', $this->calls);
39: $this->calls = array(); // reset for next calls
40: }
41: return $result;
42: }
43:
44: function multiqueryIgnoreResult()
45: {
46: if(count($this->calls))
47: {
48: parent::queryIgnoreResult('system.multicall', $this->calls);
49: $this->calls = array(); // reset for next calls
50: }
51: }
52: }
53:
54: ?>