Make WordPress Core

Ticket #36824: 36824.5.diff

File 36824.5.diff, 1.8 KB (added by dshanske, 8 years ago)

Refresh of the Pingme and Encloseme improvements

  • src/wp-includes/comment.php

    diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
    index 861ad6b..f8ae6df 100644
    a b function discover_pingback_server_uri( $url, $deprecated = '' ) { 
    22812281 */
    22822282function do_all_pings() {
    22832283        global $wpdb;
     2284        $post_types = get_post_types( array( 'publicly_queryable' => true ) );
    22842285
    22852286        // Do pingbacks
    2286         while ($ping = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
    2287                 delete_metadata_by_mid( 'post', $ping->meta_id );
    2288                 pingback( $ping->post_content, $ping->ID );
    2289         }
     2287        $pings = get_posts( array( 'post_type' => $post_types, 'fields' => 'ids', 'suppress_filters' => false, 'posts_per_page' => -1, 'meta_key' => '_pingme' ) );
     2288        foreach ( $pings as $ping ) {
     2289                delete_post_meta( $ping, '_pingme' );
     2290                $post = get_post( $ping );
     2291                pingback( $post->post_content, $ping );
     2292        }
    22902293
    22912294        // Do Enclosures
    2292         while ($enclosure = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
    2293                 delete_metadata_by_mid( 'post', $enclosure->meta_id );
    2294                 do_enclose( $enclosure->post_content, $enclosure->ID );
    2295         }
     2295        $enclosures = get_posts( array( 'post_type' => $post_types, 'fields' => 'ids', 'suppress_filters' => false, 'posts_per_page' => -1, 'meta_key' => '_encloseme' ) );
     2296        foreach ( $enclosures as $enclosure ) {
     2297                delete_post_meta( $enclosure, '_encloseme' );
     2298                $post = get_post ( $enclosure );
     2299                do_enclose( $post->post_content, $enclosure );
     2300        }
    22962301
    22972302        // Do Trackbacks
    22982303        $trackbacks = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE to_ping <> '' AND post_status = 'publish'");