Check for failed socket open in update-links. http://mosquito.wordpress.org/view.php?id=1025 Props: ColdForged

git-svn-id: http://svn.automattic.com/wordpress/trunk@2495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-03-29 16:58:30 +00:00
parent f1ccc3d222
commit 83a8a56f73
1 changed files with 18 additions and 18 deletions

View File

@ -23,22 +23,22 @@ $http_request .= "\r\n";
$http_request .= $query_string;
$response = '';
$fs = fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5);
fwrite($fs, $http_request);
while ( !feof($fs) )
$response .= fgets($fs, 1160); // One TCP-IP packet
fclose($fs);
$response = explode("\r\n\r\n", $response, 2);
$body = trim( $response[1] );
$body = str_replace(array("\r\n", "\r"), "\n", $body);
$returns = explode("\n", $body);
foreach ($returns as $return) :
$time = addslashes( substr($return, 0, 19) );
$uri = addslashes( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
$wpdb->query("UPDATE $wpdb->links SET link_updated = '$time' WHERE link_url = '$uri'");
endforeach;
if( false !== ( $fs = fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5) ) ) {
fwrite($fs, $http_request);
while ( !feof($fs) )
$response .= fgets($fs, 1160); // One TCP-IP packet
fclose($fs);
$response = explode("\r\n\r\n", $response, 2);
$body = trim( $response[1] );
$body = str_replace(array("\r\n", "\r"), "\n", $body);
$returns = explode("\n", $body);
foreach ($returns as $return) :
$time = addslashes( substr($return, 0, 19) );
$uri = addslashes( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
$wpdb->query("UPDATE $wpdb->links SET link_updated = '$time' WHERE link_url = '$uri'");
endforeach;
}
?>