WordPress.org

Make WordPress Core

Ticket #6840: fix_stale_enclosures-rebased.patch

File fix_stale_enclosures-rebased.patch, 1.1 KB (added by mystyman, 6 years ago)

re-based to revision 11274, adjusted inline documentation

  • wp-includes/functions.php

     
    10601060/** 
    10611061 * Check content for video and audio links to add as enclosures. 
    10621062 * 
    1063  * Will not add enclosures that have already been added. This is called as 
     1063 * Will not add enclosures that have already been added and will 
     1064 * remove enclosures that are no longer in the post. This is called as 
    10641065 * pingbacks and trackbacks. 
    10651066 * 
    10661067 * @package WordPress 
     
    10911092        debug_fwrite( $log, 'Post contents:' ); 
    10921093        debug_fwrite( $log, $content . "\n" ); 
    10931094 
     1095        foreach ( $pung as $link_test ) { 
     1096                if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post 
     1097                        $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $link_test . '%') ); 
     1098                } 
     1099        } 
     1100 
    10941101        foreach ( (array) $post_links_temp[0] as $link_test ) { 
    10951102                if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already 
    10961103                        $test = parse_url( $link_test );