Make WordPress Core

Changeset 3317


Ignore:
Timestamp:
12/16/2005 03:04:33 AM (21 years ago)
Author:
ryan
Message:

New asyncronous ping method. fixes #2048

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-footer.php

    r3306 r3317  
    77
    88</div>
    9 <?php check_for_pings(); ?>
    109<?php do_action('admin_footer', ''); ?>
    1110<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
  • trunk/wp-admin/execute-pings.php

    r3295 r3317  
    11<?php
    2 require_once('admin.php');
     2require_once('../wp-config.php');
    33
    4 if ( ! current_user_can('edit_posts') )
    5         die (__("Cheatin' uh?"));
    6 
    7 echo '/* No Styles Here */';
    84register_shutdown_function('execute_all_pings');
    95//execute_all_pings();
    … …  
    1511                foreach($pings as $ping) {
    1612                        pingback($ping->post_content, $ping->ID);
    17                         //echo "Pingback: $ping->post_title : $ping->ID<br/>";
     13                        echo "Pingback: $ping->post_title : $ping->ID<br/>";
    1814                        $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
    1915                }
    … …  
    2319                foreach($enclosures as $enclosure) {
    2420                        do_enclose($enclosure->post_content, $enclosure->ID);
    25                         //echo "Enclosure: $enclosure->post_title : $enclosure->ID<br/>";
     21                        echo "Enclosure: $enclosure->post_title : $enclosure->ID<br/>";
    2622                        $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
    2723                }
    … …  
    3026        if($trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft'")) {
    3127                foreach($trackbacks as $trackback) {
    32                         //echo "trackback : $trackback->ID<br/>";
     28                        echo "Trackback : $trackback->ID<br/>";
    3329                        do_trackbacks($trackback->ID);
    3430                }
    3531        }
    3632}
     33
     34_e('Done.');
     35
    3736?>
  • trunk/wp-includes/comment-functions.php

    r3272 r3317  
    640640
    641641                if ($pingback_server_url) {
    642                         set_time_limit( 60 );
     642                        @ set_time_limit( 60 );
    643643                         // Now, the RPC call
    644644                        debug_fwrite($log, "Page Linked To: $pagelinkedto \n");
  • trunk/wp-includes/functions-post.php

    r3311 r3317  
    182182                do_action('publish_post', $post_ID);
    183183
    184                 if ($post_pingback && !defined('WP_IMPORTING'))
    185                         $result = $wpdb->query("
    186                                 INSERT INTO $wpdb->postmeta
    187                                 (post_id,meta_key,meta_value)
    188                                 VALUES ('$post_ID','_pingme','1')
    189                         ");
    190                 if ( !defined('WP_IMPORTING') )
     184                if ( !defined('WP_IMPORTING') ) {
     185                        if ( $post_pingback )
     186                                $result = $wpdb->query("
     187                                        INSERT INTO $wpdb->postmeta
     188                                        (post_id,meta_key,meta_value)
     189                                        VALUES ('$post_ID','_pingme','1')
     190                                ");
    191191                        $result = $wpdb->query("
    192192                                INSERT INTO $wpdb->postmeta
    … …  
    194194                                VALUES ('$post_ID','_encloseme','1')
    195195                        ");
    196                 //register_shutdown_function('do_trackbacks', $post_ID);
    197         }       else if ($post_status == 'static') {
     196                        spawn_pinger();
     197                }
     198        } else if ($post_status == 'static') {
    198199                generate_page_rewrite_rules();
    199200
    … …  
    703704                        trackback($tb_ping, $post_title, $excerpt, $post_id);
    704705                        $pinged[] = $tb_ping;
     706                } else {
     707                        $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'");
    705708                }
    706709        endforeach; endif;
  • trunk/wp-includes/functions.php

    r3303 r3317  
    861861        $tb_url = addslashes( $tb_url );
    862862        $wpdb->query("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = '$ID'");
    863         return $wpdb->query("UPDATE $wpdb->posts SET to_ping = REPLACE(to_ping, '$tb_url', '') WHERE ID = '$ID'");
     863        return $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = '$ID'");
    864864}
    865865
    … …  
    938938}
    939939
    940 function check_for_pings() {
     940function spawn_pinger() {
    941941        global $wpdb;
    942942        $doping = false;
    … …  
    947947                $doping = true;
    948948
    949         if ( $doping )
    950                 echo '<iframe id="pingcheck" src="' . get_settings('siteurl') .'/wp-admin/execute-pings.php?time=' . time() . '" style="border:none;width:1px;height:1px;"></iframe>';
     949        if ( $doping ) {
     950                $ping_url = get_settings('siteurl') .'/wp-admin/execute-pings.php';
     951                $parts = parse_url($ping_url);
     952                $argyle = @ fsockopen($parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01);
     953                if ( $argyle )
     954                        fputs($argyle, "GET {$parts['path']}?time=".time()." HTTP/1.0\r\nHost: {$_SERVER['HTTP_HOST']}\r\n\r\n");
     955       }
    951956}
    952957
Note: See TracChangeset for help on using the changeset viewer.