WordPress.org

Make WordPress Core

Changeset 11732


Ignore:
Timestamp:
07/21/2009 07:44:21 PM (9 years ago)
Author:
ryan
Message:

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 trunk

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r11731 r11732  
    14361436    }
    14371437
     1438    set_transient('generic_ping_last', time(), 1800);
     1439
    14381440    return $post_id;
    14391441}
  • trunk/wp-includes/post.php

    r11578 r11732  
    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
    3277         // 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');
     3277        // do generic pings once per half hour at most
     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
Note: See TracChangeset for help on using the changeset viewer.