Image file editor: fix a wrong error message when restoring an edited image and IMAGE_EDIT_OVERWRITE is set. Props tiqbiz, fixes #30167.

Built from https://develop.svn.wordpress.org/trunk@31070


git-svn-id: http://core.svn.wordpress.org/trunk@31051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-01-07 22:48:22 +00:00
parent 23a5deba53
commit 00ff6675a2
2 changed files with 5 additions and 3 deletions

View File

@ -567,7 +567,7 @@ function stream_preview_image( $post_id ) {
function wp_restore_image($post_id) {
$meta = wp_get_attachment_metadata($post_id);
$file = get_attached_file($post_id);
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
$backup_sizes = $old_backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
$restored = false;
$msg = new stdClass;
@ -629,7 +629,9 @@ function wp_restore_image($post_id) {
}
}
if ( !wp_update_attachment_metadata($post_id, $meta) || !update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes) ) {
if ( ! wp_update_attachment_metadata( $post_id, $meta ) ||
( $old_backup_sizes !== $backup_sizes && ! update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ) ) ) {
$msg->error = __('Cannot save image metadata.');
return $msg;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31069';
$wp_version = '4.2-alpha-31070';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.