Jetpack_IXR_ClientMulticall

IXR_ClientMulticall.

Defined (1)

The class is defined in the following location(s).

/class.jetpack-ixr-client.php  
  1. class Jetpack_IXR_ClientMulticall extends Jetpack_IXR_Client { 
  2. public $calls = array(); 
  3.  
  4. function __construct( $args = array(), $path = false, $port = 80, $timeout = 15 ) { 
  5. parent::__construct( $args, $path, $port, $timeout ); 
  6.  
  7. function addCall() { 
  8. $args = func_get_args(); 
  9. $methodName = array_shift( $args ); 
  10. $struct = array( 
  11. 'methodName' => $methodName,  
  12. 'params' => $args 
  13. ); 
  14. $this->calls[] = $struct; 
  15.  
  16. function query() { 
  17. usort( $this->calls, array( $this, 'sort_calls' ) ); 
  18.  
  19. // Prepare multicall, then call the parent::query() method 
  20. return parent::query( 'system.multicall', $this->calls ); 
  21.  
  22. // Make sure syncs are always done first 
  23. function sort_calls( $a, $b ) { 
  24. if ( 'jetpack.syncContent' == $a['methodName'] ) { 
  25. return -1; 
  26.  
  27. if ( 'jetpack.syncContent' == $b['methodName'] ) { 
  28. return 1; 
  29.  
  30. return 0;