diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php index cdb1cf8e98..f8a9d507f7 100644 --- a/wp-admin/includes/image-edit.php +++ b/wp-admin/includes/image-edit.php @@ -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; } diff --git a/wp-includes/version.php b/wp-includes/version.php index a61d23176a..07c5836780 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.