Let me apologize for the initial question I had about your motives. I see a lot of "how can I remotely retrieve all posts from another blog" questions and immediately assume there is nefarious intent because, 9 times out of 10, there is. That said, your purposes seem very straight-forward and respectable.
Currently, there is no way to "chunk" the XML return of any of the three requests you've mentioned. When I got up this morning, though, I saw you've proposed this as a feature enhancement through Trac. This definitely won't make it in to Wordpress 3.1, so you'll likely be waiting a few months (or longer) before any submitted patches make it into core. But this is a good start.
In the mean time, remember that the XML-RPC API is extensible. While there is no way to receive "chunks" in the existing API, you can always add your own method. This is actually the best way to get a patch in core - create your own method, make sure it works, and submit the patch back to Trac.
My guess is that your method would be very similar to metaWeblog.getRecentPosts
, but would be named a bit better ... perhaps wp.getPagedPosts
. You could accept all the same parameters, but add one: "pagenumber". This way you could set the request to return 50 posts at a time and progressively walk through the collection.
To add your method, you hook into the xmlrpc_methods
filter:
function xml_add_method( $methods ) {
$methods['wp.getPagedPosts'] = 'wp_getPagedPosts';
return $methods;
}
add_filter( 'xmlrpc_methods', 'xml_add_method');
Then add your callback function:
function wp_getPagedPosts($args) {
// $this->escape($args); //<-- This is called by native XML-RPC methods to sanitize passed arrays for the database.
$blog_ID = (int) $args[0];
$username = $args[1];
$password = $args[2];
if ( isset( $args[3] ) )
$query = array( 'numberposts' => absint( $args[3] ) );
else
$query = array();
if ( !$user = $this->login($username, $password) )
return $this->error;
do_action('xmlrpc_call', 'wp.getPagedPosts');
//... get a list of posts and generate your XML-RPC return ...
}
Remember, this is code you'd place in an external plug-in file or a functions.php
file with your theme to support the additional XML-RPC request. There aren't any existing methods to handle this, so you're stuck with writing your own. But if you do it once, and do it well, and submit it back to Trac ... it could become Core, then you wouldn't have to do it again.