WordPress.org

Make WordPress Core

Ticket #1577: execute-pings.patch

File execute-pings.patch, 1.8 KB (added by skippy, 13 years ago)
  • execute-pings.php

     
    1111function execute_all_pings() {
    1212        global $wpdb;
    1313        // Do pingbacks
    14         if($pings = $wpdb->get_results("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme';")) {
     14        $now = current_time('mysql', 1);
     15        if($pings = $wpdb->get_results("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->posts}.post_date < $now AND {$wpdb->postmeta}.meta_key = '_pingme';")) {
    1516                foreach($pings as $ping) {
    1617                        pingback($ping->post_content, $ping->ID);
    1718                        //echo "Pingback: $ping->post_title : $ping->ID<br/>";
     
    1920                }
    2021        }
    2122        // Do Enclosures
    22         if($enclosures = $wpdb->get_results("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme';")) {
     23        if($enclosures = $wpdb->get_results("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->posts}.post_date < $now AND {$wpdb->postmeta}.meta_key = '_encloseme';")) {
    2324                foreach($enclosures as $enclosure) {
    2425                        do_enclose($enclosure->post_content, $enclosure->ID);
    2526                        //echo "Enclosure: $enclosure->post_title : $enclosure->ID<br/>";
     
    2728                }
    2829        }
    2930        // Do Trackbacks
    30         if($trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != ''")) {
     31        if($trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_date < $now")) {
    3132                foreach($trackbacks as $trackback) {
    3233                        //echo "trackback : $trackback->ID<br/>";
    3334                        do_trackbacks($trackback->ID);
    3435                }
    3536        }
    3637}
    37 ?>
    38  No newline at end of file
     38?>