$method_name, 'params' => $args, ); $this->calls[] = $struct; } /** * Perform the IXR multicall request. * * @param string[] ...$args IXR args. * * @return bool True if request succeeded, false otherwise. */ public function query( ...$args ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable $this->calls = $this->sort_calls( $this->calls ); // Prepare multicall, then call the parent::query() method. return parent::query( 'system.multicall', $this->calls ); } /** * Sort the IXR calls. * Make sure syncs are always done first preserving relative order. * * @param array $calls Calls to sort. * @return array Sorted calls. */ public function sort_calls( $calls ) { $sync_calls = array(); $other_calls = array(); foreach ( $calls as $call ) { if ( 'jetpack.syncContent' === $call['methodName'] ) { $sync_calls[] = $call; } else { $other_calls[] = $call; } } return array_merge( $sync_calls, $other_calls ); } }