Make WordPress Core

Opened 12 years ago

Closed 8 years ago

Last modified 8 years ago

#21085 closed enhancement (worksforme)

Better XML-RPC media handling

Reported by: markoheijnen's profile markoheijnen Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.3
Component: XML-RPC Keywords: reporter-feedback needs-patch
Focuses: Cc:


In 3.4 there was a lot of improvements. For 3.5 I would like to see some major improvement in wp.uploadFile and metaWeblog.newMediaObject.

At this moment you can't insert a description, alternate text or caption. ( #5461/#18684 ). Also the file can't be attached to a post ( #13917 ).

The overwrite functionality also doesn't work ( #17604 ). Not sure why this exists since WordPress itself doesn't do this.

Also the current way isn't how WordPress does it internally. wp_handle_upload() doesn't get used (#6559).

There is also going on something wrong with mime types ( #12518 ).

Also the work from 3.4 should be implemented ( #6430 ).

Last thing is that WordPress normally also looks at the EXIF information. At this moment the XML-RPC also doesn't do that ( #18087 )

rarely related: #12493 - filter for wp_upload_bits

Attachments (1)

patch-core-21085-wp_deleteMediaItem-1.diff (1.7 KB) - added by koke 12 years ago.

Download all attachments as: .zip

Change History (21)

#1 @maxcutler
12 years ago

  • Cc maxcutler added

I worry that it will be difficult to add new features and fix all of these issues without breaking existing clients. Media uploading is already a problematic area for many clients, and trying to patch wp.uploadFile/mw.newMediaObject without breaking things is likely not worth the effort.

Instead, I propose that we add a new method for creating and editing media/attachments that is better aligned with modern core functionality:

  • Create a new wp.newMediaItem method for uploading files.
  • Create a new wp.editMediaItem method for editing existing media files.
  • Create a wp.getMediaItems alias for the existing wp.getMediaLibrary method.
  • Deprecate wp.uploadFile and mw.newMediaObject (though all of mw.*, mt.* and blogger.* should be deprecated).

#2 @isaackeyet
12 years ago

  • Cc isaackeyet added

+1 for an updated way to handle new media items specifically. Images should be attachable to posts directly.

#3 @markoheijnen
12 years ago

There should also be an method for removing a media item. See #5310

#4 @markoheijnen
12 years ago

  • Summary changed from mw_newMediaObject needs more functionality to Better XML-RPC media handling

#5 @martythornley
12 years ago

  • Cc marty@… added

#6 @daniloercoli
12 years ago

  • Cc ercoli@… added

#7 @pento
12 years ago

  • Cc gary@… added

Related - adding resumable upload support to the XML-RPC API: #21497

#8 @koke
12 years ago

  • Cc jbernal@… added
  • Keywords mobile added

#9 @koke
12 years ago

Added patch with wp.deleteMediaItem. I wonder if that method should have an extra $force_delete argument (see wp_delete_attachment)

Last edited 12 years ago by koke (previous) (diff)

#10 @nacin
12 years ago

The same parameter should be added to wp.deletePost. Currently it must be called twice to delete the post, as the first one trashes.

#11 follow-up: @nacin
12 years ago

Note also that attachments do not have trash enabled, so wp.deleteMediaItem should not actually bother with a force_delete for now.

#12 in reply to: ↑ 11 @koke
12 years ago

Replying to nacin:

Note also that attachments do not have trash enabled, so wp.deleteMediaItem should not actually bother with a force_delete for now.

OK, the docs for wp_delete_attachment made me think otherwise

#13 @nacin
12 years ago

  • Keywords 2nd-opinion added

The cap check here should be delete_post, $post_id. And in that case, the cap check should come before the invalid ID check.

Not sure why wp.deleteMediaItem should be needed — wp.deletePost is functionally equivalent. At most wp.deleteMediaItem should be an alias.

#14 @nacin
12 years ago

I see a lot of tickets listed in the description here, but few of them are currently slated for 3.5, and few have any recent activity. Not sure what else to do here.

#15 @markoheijnen
12 years ago

  • Type changed from defect (bug) to enhancement

I punted it for now. It's something that need to be discussed more but way to late for 3.5 since it's an enchantment of the existing API.

#16 @markoheijnen
12 years ago

  • Milestone changed from 3.5 to Future Release

#17 @chriscct7
9 years ago

  • Keywords reporter-feedback added; mobile 2nd-opinion removed

@markoheijnen did you want to continue persuing this?

#18 @chriscct7
8 years ago

  • Keywords needs-patch added

#19 @markoheijnen
8 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

No need to continue pursuing this.

#20 @dd32
8 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.