Make WordPress Core


Ignore:
Timestamp:
05/09/2006 10:44:51 PM (19 years ago)
Author:
ryan
Message:

Add file deletion filter. Props to that Andy guy. fixes #2703

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions-post.php

    r3740 r3768  
    385385    if ( ! empty($meta['thumb']) ) {
    386386        // Don't delete the thumb if another attachment uses it
    387         if (! $foo = $wpdb->get_row("SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE '%".$wpdb->escape($meta['thumb'])."%' AND post_id <> '$postid'"))
    388             @ unlink(str_replace(basename($file), $meta['thumb'], $file));
    389     }
     387        if (! $wpdb->get_row("SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE '%".$wpdb->escape($meta['thumb'])."%' AND post_id <> $postid")) {
     388            $thumbfile = str_replace(basename($file), $meta['thumb'], $file);
     389            $thumbfile = apply_filters('wp_delete_file', $thumbfile);
     390            @ unlink($thumbfile);
     391        }
     392    }
     393
     394    $file = apply_filters('wp_delete_file', $file);
    390395
    391396    if ( ! empty($file) )
Note: See TracChangeset for help on using the changeset viewer.