From 05d4c954acdc05bd9d68743a2429f69f8a2c79e1 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 20 May 2009 17:03:19 +0000 Subject: [PATCH] Throttle generic pings to no more than once per hour. Props Denis-de-Bernardy. fixes #6698 git-svn-id: http://svn.automattic.com/wordpress/trunk@11410 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 3 --- wp-includes/default-filters.php | 1 + wp-includes/post.php | 3 +++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 615b2e2690..b86b3a8458 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1324,9 +1324,6 @@ function do_all_pings() { if ( is_array($trackbacks) ) foreach ( $trackbacks as $trackback ) do_trackbacks($trackback); - - //Do Update Services/Generic Pings - generic_ping(); } /** diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 6afafd1845..e07b206be8 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -186,6 +186,7 @@ add_action('do_feed_rss', 'do_feed_rss', 10, 1); add_action('do_feed_rss2', 'do_feed_rss2', 10, 1); add_action('do_feed_atom', 'do_feed_atom', 10, 1); add_action('do_pings', 'do_all_pings', 10, 1); +add_action('do_generic_ping', 'generic_ping', 10, 1); add_action('do_robots', 'do_robots'); add_action('sanitize_comment_cookies', 'sanitize_comment_cookies'); add_action('admin_print_scripts', 'print_head_scripts', 20); diff --git a/wp-includes/post.php b/wp-includes/post.php index 1e6021d139..74ce1598ee 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3244,6 +3244,9 @@ function _transition_post_status($new_status, $old_status, $post) { if ( '' == get_the_guid($post->ID) ) $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish + // do generic pings once per hour at most + if ( !wp_next_scheduled('do_generic_ping') ) + wp_schedule_single_event(time() + 3600, 'do_generic_ping'); } // Always clears the hook in case the post status bounced from future to draft.