WordPress.org

Make WordPress Core

Ticket #6698: wordpress_generic_ping_ticket_6698_2.patch

File wordpress_generic_ping_ticket_6698_2.patch, 1.2 KB (added by VoxPelli, 9 years ago)

Switched from pure options to transients and removed the 60 seconds throttle

  • wp-includes/comment.php

    diff --git wp-includes/comment.php wp-includes/comment.php
    index b4f4125..d9e9f7a 100644
    function generic_ping($post_id = 0) { 
    13861386                        weblog_ping($service);
    13871387        }
    13881388
     1389        set_transient('generic_ping_last', time(), 1800);
     1390
    13891391        return $post_id;
    13901392}
    13911393
  • wp-includes/post.php

    diff --git wp-includes/post.php wp-includes/post.php
    index 0c0ba46..8fad32d 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                        $schedule = time();
     3280                        $last_ping = get_transient('generic_ping_last');
     3281                        if ($last_ping) {
     3282                          $schedule = max($schedule, $last_ping + 1800);
     3283                        }
     3284                        wp_schedule_single_event($schedule, 'do_generic_ping');
     3285                }
    32803286        }
    32813287
    32823288        // Always clears the hook in case the post status bounced from future to draft.