WordPress.org

Make WordPress Core

Ticket #36824: 36824.patch

File 36824.patch, 3.3 KB (added by spacedmonkey, 4 years ago)

First pass at a patch

  • src/wp-includes/comment.php

     
    22632263        global $wpdb;
    22642264
    22652265        // Do pingbacks
    2266         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")) {
    2267                 delete_metadata_by_mid( 'post', $ping->meta_id );
     2266        $pings = get_posts( array( 'post_type' => 'any', 'posts_per_page' => -1, 'meta_value' => '_pingme', 'fields' => 'ids' ) );
     2267        foreach ( $pings as $ping ) {
     2268                delete_post_meta( $ping->ID, '_pingme' );
    22682269                pingback( $ping->post_content, $ping->ID );
    22692270        }
    22702271
    22712272        // Do Enclosures
    2272         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")) {
    2273                 delete_metadata_by_mid( 'post', $enclosure->meta_id );
     2273        $enclosures = get_posts( array( 'post_type' => 'any', 'posts_per_page' => -1, 'meta_value' => '_encloseme', 'fields' => 'ids' ) );
     2274        foreach ( $enclosures as $enclosure ) {
     2275                delete_post_meta( $enclosure->ID, '_encloseme' );
    22742276                do_enclose( $enclosure->post_content, $enclosure->ID );
    22752277        }
    22762278
    22772279        // Do Trackbacks
    2278         $trackbacks = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE to_ping <> '' AND post_status = 'publish'");
    2279         if ( is_array($trackbacks) )
    2280                 foreach ( $trackbacks as $trackback )
    2281                         do_trackbacks($trackback);
     2280        $trackbacks = get_posts( array( 'post_type' => 'any', 'posts_per_page' => -1, 'to_ping' => '', 'fields' => 'ids' ) );
     2281        foreach ( $trackbacks as $trackback ) {
     2282                do_trackbacks( $trackback );
     2283        }
    22822284
    22832285        //Do Update Services/Generic Pings
    22842286        generic_ping();
  • src/wp-includes/query.php

     
    15651565         *     @type array        $tax_query               An associative array of WP_Tax_Query arguments.
    15661566         *                                                 See WP_Tax_Query->queries.
    15671567         *     @type string       $title                   Post title.
     1568         *     @type string       $to_ping                 Post ping status. Default false.
    15681569         *     @type bool         $update_post_meta_cache  Whether to update the post meta cache. Default true.
    15691570         *     @type bool         $update_post_term_cache  Whether to update the post term cache. Default true.
    15701571         *     @type int          $w                       The week number of the year. Default empty. Accepts numbers 0-53.
     
    15991600                $qv['pagename'] = trim( $qv['pagename'] );
    16001601                $qv['name'] = trim( $qv['name'] );
    16011602                $qv['title'] = trim( $qv['title'] );
     1603                $qv['to_ping'] = isset( $qv['to_ping'] ) ? $qv['to_ping'] : false;
    16021604                if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
    16031605                if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
    16041606                if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
     
    30763078                        $post_type_object = get_post_type_object ( 'post' );
    30773079                }
    30783080
     3081                if ( $q['to_ping'] !== false ) {
     3082                        $where .= " AND {$wpdb->posts}.to_ping = " . $q['to_ping'];
     3083                }
     3084
    30793085                $edit_cap = 'edit_post';
    30803086                $read_cap = 'read_post';
    30813087