Process waiting pings a half hour after the last ping to avoid spamming ping sites. Don't make a ping wait if the last ping was more than half an hour ago. Props VoxPelli. fixes #6698 for 2.8
git-svn-id: http://svn.automattic.com/wordpress/branches/2.8@11733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
623d899936
commit
af6fef4026
|
@ -1386,6 +1386,8 @@ function generic_ping($post_id = 0) {
|
||||||
weblog_ping($service);
|
weblog_ping($service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_transient('generic_ping_last', time(), 1800);
|
||||||
|
|
||||||
return $post_id;
|
return $post_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3274,9 +3274,15 @@ function _transition_post_status($new_status, $old_status, $post) {
|
||||||
if ( '' == get_the_guid($post->ID) )
|
if ( '' == get_the_guid($post->ID) )
|
||||||
$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $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_action('private_to_published', $post->ID); // Deprecated, use private_to_publish
|
||||||
// do generic pings once per hour at most
|
// do generic pings once per half hour at most
|
||||||
if ( !wp_next_scheduled('do_generic_ping') )
|
if ( !wp_next_scheduled('do_generic_ping') ) {
|
||||||
wp_schedule_single_event(time() + 3600, 'do_generic_ping');
|
$schedule = time();
|
||||||
|
$last_ping = get_transient('generic_ping_last');
|
||||||
|
if ($last_ping) {
|
||||||
|
$schedule = max($schedule, $last_ping + 1800);
|
||||||
|
}
|
||||||
|
wp_schedule_single_event($schedule, 'do_generic_ping');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always clears the hook in case the post status bounced from future to draft.
|
// Always clears the hook in case the post status bounced from future to draft.
|
||||||
|
|
Loading…
Reference in New Issue