Check for failed socket open in update-links. http://mosquito.wordpress.org/view.php?id=1025 Props: ColdForged
git-svn-id: https://develop.svn.wordpress.org/trunk@2495 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
bb00ba2e95
commit
3e484233f4
|
@ -23,22 +23,22 @@ $http_request .= "\r\n";
|
||||||
$http_request .= $query_string;
|
$http_request .= $query_string;
|
||||||
|
|
||||||
$response = '';
|
$response = '';
|
||||||
$fs = fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5);
|
if( false !== ( $fs = fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5) ) ) {
|
||||||
fwrite($fs, $http_request);
|
fwrite($fs, $http_request);
|
||||||
while ( !feof($fs) )
|
while ( !feof($fs) )
|
||||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||||
fclose($fs);
|
fclose($fs);
|
||||||
|
|
||||||
$response = explode("\r\n\r\n", $response, 2);
|
$response = explode("\r\n\r\n", $response, 2);
|
||||||
$body = trim( $response[1] );
|
$body = trim( $response[1] );
|
||||||
$body = str_replace(array("\r\n", "\r"), "\n", $body);
|
$body = str_replace(array("\r\n", "\r"), "\n", $body);
|
||||||
|
|
||||||
$returns = explode("\n", $body);
|
$returns = explode("\n", $body);
|
||||||
|
|
||||||
foreach ($returns as $return) :
|
foreach ($returns as $return) :
|
||||||
$time = addslashes( substr($return, 0, 19) );
|
$time = addslashes( substr($return, 0, 19) );
|
||||||
$uri = addslashes( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
|
$uri = addslashes( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
|
||||||
$wpdb->query("UPDATE $wpdb->links SET link_updated = '$time' WHERE link_url = '$uri'");
|
$wpdb->query("UPDATE $wpdb->links SET link_updated = '$time' WHERE link_url = '$uri'");
|
||||||
endforeach;
|
endforeach;
|
||||||
|
}
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue