diff --git a/wp-admin/admin-footer.php b/wp-admin/admin-footer.php index 1e619a7114..acecf37735 100644 --- a/wp-admin/admin-footer.php +++ b/wp-admin/admin-footer.php @@ -6,8 +6,7 @@

- - + \ No newline at end of file diff --git a/wp-admin/execute-pings.php b/wp-admin/execute-pings.php index 69811f7444..10be97b16e 100644 --- a/wp-admin/execute-pings.php +++ b/wp-admin/execute-pings.php @@ -1,10 +1,6 @@ get_results("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme';")) { foreach($pings as $ping) { pingback($ping->post_content, $ping->ID); - //echo "Pingback: $ping->post_title : $ping->ID
"; + echo "Pingback: $ping->post_title : $ping->ID
"; $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';"); } } @@ -22,16 +18,19 @@ function execute_all_pings() { if($enclosures = $wpdb->get_results("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme';")) { foreach($enclosures as $enclosure) { do_enclose($enclosure->post_content, $enclosure->ID); - //echo "Enclosure: $enclosure->post_title : $enclosure->ID
"; + echo "Enclosure: $enclosure->post_title : $enclosure->ID
"; $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';"); } } // Do Trackbacks if($trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft'")) { foreach($trackbacks as $trackback) { - //echo "trackback : $trackback->ID
"; + echo "Trackback : $trackback->ID
"; do_trackbacks($trackback->ID); } } } + +_e('Done.'); + ?> diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index b448ed7b6e..a056835014 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -639,7 +639,7 @@ function pingback($content, $post_ID) { $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048); if ($pingback_server_url) { - set_time_limit( 60 ); + @ set_time_limit( 60 ); // Now, the RPC call debug_fwrite($log, "Page Linked To: $pagelinkedto \n"); debug_fwrite($log, 'Page Linked From: '); diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index 76460fc86d..e0136d4d49 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -181,20 +181,21 @@ function wp_insert_post($postarr = array()) { if ($post_status == 'publish') { do_action('publish_post', $post_ID); - if ($post_pingback && !defined('WP_IMPORTING')) - $result = $wpdb->query(" - INSERT INTO $wpdb->postmeta - (post_id,meta_key,meta_value) - VALUES ('$post_ID','_pingme','1') - "); - if ( !defined('WP_IMPORTING') ) + if ( !defined('WP_IMPORTING') ) { + if ( $post_pingback ) + $result = $wpdb->query(" + INSERT INTO $wpdb->postmeta + (post_id,meta_key,meta_value) + VALUES ('$post_ID','_pingme','1') + "); $result = $wpdb->query(" INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value) VALUES ('$post_ID','_encloseme','1') "); - //register_shutdown_function('do_trackbacks', $post_ID); - } else if ($post_status == 'static') { + spawn_pinger(); + } + } else if ($post_status == 'static') { generate_page_rewrite_rules(); if ( !empty($page_template) ) @@ -702,6 +703,8 @@ function do_trackbacks($post_id) { if ( !in_array($tb_ping, $pinged) ) { trackback($tb_ping, $post_title, $excerpt, $post_id); $pinged[] = $tb_ping; + } else { + $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'"); } endforeach; endif; } diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 4fb97351a7..9f20b1f2ae 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -860,7 +860,7 @@ function trackback($trackback_url, $title, $excerpt, $ID) { $tb_url = addslashes( $tb_url ); $wpdb->query("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = '$ID'"); - return $wpdb->query("UPDATE $wpdb->posts SET to_ping = REPLACE(to_ping, '$tb_url', '') WHERE ID = '$ID'"); + return $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = '$ID'"); } function make_url_footnote($content) { @@ -937,7 +937,7 @@ function debug_fclose($fp) { } } -function check_for_pings() { +function spawn_pinger() { global $wpdb; $doping = false; if ( $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' LIMIT 1") ) @@ -946,8 +946,13 @@ function check_for_pings() { if ( $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_pingme' OR meta_key = '_encloseme' LIMIT 1") ) $doping = true; - if ( $doping ) - echo ''; + if ( $doping ) { + $ping_url = get_settings('siteurl') .'/wp-admin/execute-pings.php'; + $parts = parse_url($ping_url); + $argyle = @ fsockopen($parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01); + if ( $argyle ) + fputs($argyle, "GET {$parts['path']}?time=".time()." HTTP/1.0\r\nHost: {$_SERVER['HTTP_HOST']}\r\n\r\n"); + } } function do_enclose( $content, $post_ID ) {