WordPress.org

Make WordPress Core

Changeset 31070


Ignore:
Timestamp:
01/07/2015 10:47:32 PM (7 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/image-edit.php

    r31043 r31070  
    568568    $meta = wp_get_attachment_metadata($post_id);
    569569    $file = get_attached_file($post_id);
    570     $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
     570    $backup_sizes = $old_backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
    571571    $restored = false;
    572572    $msg = new stdClass;
     
    630630    }
    631631
    632     if ( !wp_update_attachment_metadata($post_id, $meta) || !update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes) ) {
     632    if ( ! wp_update_attachment_metadata( $post_id, $meta ) ||
     633        ( $old_backup_sizes !== $backup_sizes && ! update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ) ) ) {
     634
    633635        $msg->error = __('Cannot save image metadata.');
    634636        return $msg;
Note: See TracChangeset for help on using the changeset viewer.