WordPress.org

Make WordPress Core

Ticket #6698: wordpress_generic_ping_ticket_6698.patch

File wordpress_generic_ping_ticket_6698.patch, 1.4 KB (added by VoxPelli, 6 years ago)

Patch for changing one hour delay to one minute and instead having a minimum of half an hour wait between pings

  • wp-includes/comment.php

    diff --git wp-includes/comment.php wp-includes/comment.php
    index b4f4125..0e92a4b 100644
    function do_trackbacks($post_id) { 
    13771377 * @return int Same as Post ID from parameter 
    13781378 */ 
    13791379function generic_ping($post_id = 0) { 
     1380        $last_ping = get_option('generic_ping_last'); 
     1381 
     1382        if ( $last_ping === false ) { 
     1383                add_option('generic_ping_last', time()); 
     1384        } else { 
     1385                update_option('generic_ping_last', time()); 
     1386        } 
     1387 
    13801388        $services = get_option('ping_sites'); 
    13811389 
    13821390        $services = explode("\n", $services); 
  • wp-includes/post.php

    diff --git wp-includes/post.php wp-includes/post.php
    index 0c0ba46..cfe755f 100644
    function _transition_post_status($new_status, $old_status, $post) { 
    32753275                        $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); 
    32763276                do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish 
    32773277                // do generic pings once per hour at most 
    3278                 if ( !wp_next_scheduled('do_generic_ping') ) 
    3279                         wp_schedule_single_event(time() + 3600, 'do_generic_ping'); 
     3278                if ( !wp_next_scheduled('do_generic_ping') ) { 
     3279                        $last_ping = get_option('generic_ping_last', 0); 
     3280                        wp_schedule_single_event(max(time() + 60, $last_ping + 1800), 'do_generic_ping'); 
     3281                } 
    32803282        } 
    32813283 
    32823284        // Always clears the hook in case the post status bounced from future to draft.