Housekeeping -- clean out debug calls.

git-svn-id: http://svn.automattic.com/wordpress/trunk@5307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rob1n 2007-04-24 23:58:51 +00:00
parent 559fa91b8d
commit 56add54053

View File

@ -672,9 +672,7 @@ function pingback($content, $post_ID) {
include_once(ABSPATH . WPINC . '/class-IXR.php'); include_once(ABSPATH . WPINC . '/class-IXR.php');
// original code by Mort (http://mort.mine.nu:8080) // original code by Mort (http://mort.mine.nu:8080)
$log = debug_fopen(ABSPATH . '/pingback.log', 'a');
$post_links = array(); $post_links = array();
debug_fwrite($log, 'BEGIN ' . date('YmdHis', time()) . "\n");
$pung = get_pung($post_ID); $pung = get_pung($post_ID);
@ -690,10 +688,6 @@ function pingback($content, $post_ID) {
// http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php // http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php
preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp); preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp);
// Debug
debug_fwrite($log, 'Post contents:');
debug_fwrite($log, $content."\n");
// Step 2. // Step 2.
// Walking thru the links array // Walking thru the links array
// first we get rid of links pointing to sites, not to specific files // first we get rid of links pointing to sites, not to specific files
@ -717,16 +711,12 @@ function pingback($content, $post_ID) {
do_action_ref_array('pre_ping', array(&$post_links, &$pung)); do_action_ref_array('pre_ping', array(&$post_links, &$pung));
foreach ( (array) $post_links as $pagelinkedto ) { foreach ( (array) $post_links as $pagelinkedto ) {
debug_fwrite($log, "Processing -- $pagelinkedto\n");
$pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048); $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048);
if ( $pingback_server_url ) { if ( $pingback_server_url ) {
@ set_time_limit( 60 ); @ set_time_limit( 60 );
// Now, the RPC call // Now, the RPC call
debug_fwrite($log, "Page Linked To: $pagelinkedto \n");
debug_fwrite($log, 'Page Linked From: ');
$pagelinkedfrom = get_permalink($post_ID); $pagelinkedfrom = get_permalink($post_ID);
debug_fwrite($log, $pagelinkedfrom."\n");
// using a timeout of 3 seconds should be enough to cover slow servers // using a timeout of 3 seconds should be enough to cover slow servers
$client = new IXR_Client($pingback_server_url); $client = new IXR_Client($pingback_server_url);
@ -738,13 +728,8 @@ function pingback($content, $post_ID) {
if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) ) if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) )
add_ping( $post_ID, $pagelinkedto ); add_ping( $post_ID, $pagelinkedto );
else
debug_fwrite($log, "Error.\n Fault code: ".$client->getErrorCode()." : ".$client->getErrorMessage()."\n");
} }
} }
debug_fwrite($log, "\nEND: ".time()."\n****************************\n");
debug_fclose($log);
} }
@ -780,16 +765,6 @@ function trackback($trackback_url, $title, $excerpt, $ID) {
$trackback_url['port'] = 80; $trackback_url['port'] = 80;
$fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4);
@fputs($fs, $http_request); @fputs($fs, $http_request);
/*
$debug_file = 'trackback.log';
$fp = fopen($debug_file, 'a');
fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n");
while(!@feof($fs)) {
fwrite($fp, @fgets($fs, 4096));
}
fwrite($fp, "\n\n");
fclose($fp);
*/
@fclose($fs); @fclose($fs);
$tb_url = addslashes( $tb_url ); $tb_url = addslashes( $tb_url );