XML-RPC: upgrade the resposnse of`wp_xmlrpc_server::mw_newMediaObject()` based on work down in 3.4 so that it runs the struct through `->_prepare_media_item()`.

Props markoheijnen.
Fixes #6430.


git-svn-id: https://develop.svn.wordpress.org/trunk@34579 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-09-26 05:14:08 +00:00
parent 20020ebf2b
commit 90ad5546d5
1 changed files with 7 additions and 6 deletions

View File

@ -906,6 +906,7 @@ class wp_xmlrpc_server extends IXR_Server {
'caption' => $media_item->post_excerpt, 'caption' => $media_item->post_excerpt,
'description' => $media_item->post_content, 'description' => $media_item->post_content,
'metadata' => wp_get_attachment_metadata( $media_item->ID ), 'metadata' => wp_get_attachment_metadata( $media_item->ID ),
'type' => $media_item->post_mime_type
); );
$thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size ); $thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size );
@ -5770,12 +5771,12 @@ class wp_xmlrpc_server extends IXR_Server {
*/ */
do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args ); do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args );
$struct = array( $struct = $this->_prepare_media_item( get_post( $id ) );
'id' => strval( $id ),
'file' => $name, // Deprecated values
'url' => $upload[ 'url' ], $struct['id'] = $struct['attachment_id'];
'type' => $upload[ 'type' ] $struct['file'] = $struct['title'];
); $struct['url'] = $struct['link'];
return $struct; return $struct;
} }