Make WordPress Core

Ticket #24518: post.php.patch

File post.php.patch, 1.3 KB (added by desrosj, 11 years ago)

Refreshed version of patch with some spacing adjustments to follow WordPress coding standards.

  • wp-includes/post.php

     
    40864086        $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
    40874087        $file = get_attached_file( $post_id );
    40884088
    4089         $intermediate_sizes = array();
    4090         foreach ( get_intermediate_image_sizes() as $size ) {
    4091                 if ( $intermediate = image_get_intermediate_size( $post_id, $size ) )
    4092                         $intermediate_sizes[] = $intermediate;
    4093         }
    4094 
    40954089        if ( is_multisite() )
    40964090                delete_transient( 'dirsize_cache' );
    40974091
     
    41264120        }
    41274121
    41284122        // remove intermediate and backup images if there are any
    4129         foreach ( $intermediate_sizes as $intermediate ) {
    4130                 $intermediate_file = apply_filters( 'wp_delete_file', $intermediate['path'] );
    4131                 @ unlink( path_join($uploadpath['basedir'], $intermediate_file) );
     4123        if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) {
     4124                foreach ( $meta['sizes'] as $size => $sizeinfo ) {
     4125                        $intermediate_file = str_replace( basename( $file ), $sizeinfo['file'], $file );
     4126                        $intermediate_file = apply_filters( 'wp_delete_file', $intermediate_file );
     4127                        @ unlink( path_join( $uploadpath['basedir'], $intermediate_file ) );
     4128                }
    41324129        }
    41334130
    41344131        if ( is_array($backup_sizes) ) {