Ticket #39476: 39476.diff
File 39476.diff, 1.9 KB (added by , 8 years ago) |
---|
-
src/wp-includes/post.php
4919 4919 if ( ! empty($meta['thumb']) ) { 4920 4920 // Don't delete the thumb if another attachment uses it. 4921 4921 if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id)) ) { 4922 $thumbfile = str_replace(basename($file), $meta['thumb'], $file); 4923 /** This filter is documented in wp-includes/functions.php */ 4924 $thumbfile = apply_filters( 'wp_delete_file', $thumbfile ); 4925 @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); 4922 $thumbfile = str_replace( basename( $file ), $meta['thumb'], $file ); 4923 wp_delete_file( path_join( $uploadpath['basedir'], $thumbfile ) ); 4926 4924 } 4927 4925 } 4928 4926 … … 4930 4928 if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) { 4931 4929 foreach ( $meta['sizes'] as $size => $sizeinfo ) { 4932 4930 $intermediate_file = str_replace( basename( $file ), $sizeinfo['file'], $file ); 4933 /** This filter is documented in wp-includes/functions.php */ 4934 $intermediate_file = apply_filters( 'wp_delete_file', $intermediate_file ); 4935 @ unlink( path_join( $uploadpath['basedir'], $intermediate_file ) ); 4931 wp_delete_file( path_join( $uploadpath['basedir'], $intermediate_file ) ); 4936 4932 } 4937 4933 } 4938 4934 … … 4939 4935 if ( is_array($backup_sizes) ) { 4940 4936 foreach ( $backup_sizes as $size ) { 4941 4937 $del_file = path_join( dirname($meta['file']), $size['file'] ); 4942 /** This filter is documented in wp-includes/functions.php */ 4943 $del_file = apply_filters( 'wp_delete_file', $del_file ); 4944 @ unlink( path_join($uploadpath['basedir'], $del_file) ); 4938 wp_delete_file( path_join( $uploadpath['basedir'], $del_file ) ); 4945 4939 } 4946 4940 } 4947 4941