Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jetpack_Media: Delete revision history items before updating attachme…
…nt metadata Fixes Issue # 14315 When a media file is remotely edited, the Jetpack_Media::edit_media_file() method is called. Within this method, the wp_generate_attachment_metadata() function is called. Then the Jetpack_Media::limit_revision_history() method is called, which determines if the revision history limit has been reached. If the revision history limit has been reached, the Jetpack_Media::delete_media_history_file() method is called. This method calls wp_generated_attachment_metadata(), which overwrites the attachment metadata that was just updated with the attachment metadata of the revision that is about to be deleted. This results in broken image URLs in the wp-admin media library. To fix this, call Jetpack_Media::limit_revision_history() before calling wp_generate_attachment_metadata() in the Jetpack_Media::edit_media_file() method. This will prevent the updated attachment metadata from being overwritten. Finally, fix some PHPCS warnings for comments and whitespace.
- Loading branch information