1
1
Fork 0

log every possible diaspora return for posts and comments

This commit is contained in:
Friendika 2011-08-29 22:50:41 -07:00
parent 22d9d97d71
commit 0f1bc6e957
2 changed files with 24 additions and 18 deletions

View file

@ -417,8 +417,10 @@ function diaspora_post($importer,$xml) {
dbesc($message_id), dbesc($message_id),
dbesc($guid) dbesc($guid)
); );
if(count($r)) if(count($r)) {
logger('diaspora_post: message exists: ' . $guid);
return; return;
}
// allocate a guid on our system - we aren't fixing any collisions. // allocate a guid on our system - we aren't fixing any collisions.
// we're ignoring them // we're ignoring them
@ -475,8 +477,10 @@ function diaspora_comment($importer,$xml,$msg) {
$text = $xml->text; $text = $xml->text;
$contact = diaspora_get_contact_by_handle($importer['uid'],$msg['author']); $contact = diaspora_get_contact_by_handle($importer['uid'],$msg['author']);
if(! $contact) if(! $contact) {
logger('diaspora_comment: cannot find contact: ' . $msg['author']);
return; return;
}
if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) { if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
logger('diaspora_comment: Ignoring this author.'); logger('diaspora_comment: Ignoring this author.');
@ -489,7 +493,7 @@ function diaspora_comment($importer,$xml,$msg) {
dbesc($guid) dbesc($guid)
); );
if(count($r)) { if(count($r)) {
logger('daspora_comment: our comment just got relayed back to us (or there was a guid collision) : ' . $guid); logger('diaspora_comment: our comment just got relayed back to us (or there was a guid collision) : ' . $guid);
return; return;
} }
@ -658,8 +662,10 @@ function diaspora_like($importer,$xml,$msg) {
return; return;
$contact = diaspora_get_contact_by_handle($importer['uid'],$msg['author']); $contact = diaspora_get_contact_by_handle($importer['uid'],$msg['author']);
if(! $contact) if(! $contact) {
logger('diaspora_like: cannot find contact: ' . $msg['author']);
return; return;
}
if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) { if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
logger('diaspora_like: Ignoring this author.'); logger('diaspora_like: Ignoring this author.');

View file

@ -9,37 +9,37 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
$a = get_app(); $a = get_app();
$ch = curl_init($url); $ch = @curl_init($url);
if(($redirects > 8) || (! $ch)) if(($redirects > 8) || (! $ch))
return false; return false;
curl_setopt($ch, CURLOPT_HEADER, true); @curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_USERAGENT, "Friendika"); @curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
if(intval($timeout)) { if(intval($timeout)) {
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); @curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
} }
else { else {
$curl_time = intval(get_config('system','curl_timeout')); $curl_time = intval(get_config('system','curl_timeout'));
curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60)); @curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
} }
// by default we will allow self-signed certs // by default we will allow self-signed certs
// but you can override this // but you can override this
$check_cert = get_config('system','verifyssl'); $check_cert = get_config('system','verifyssl');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false)); @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false));
$prx = get_config('system','proxy'); $prx = get_config('system','proxy');
if(strlen($prx)) { if(strlen($prx)) {
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); @curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, $prx); @curl_setopt($ch, CURLOPT_PROXY, $prx);
$prxusr = get_config('system','proxyuser'); $prxusr = @get_config('system','proxyuser');
if(strlen($prxusr)) if(strlen($prxusr))
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr); @curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
} }
if($binary) if($binary)
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); @curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$a->set_curl_code(0); $a->set_curl_code(0);
@ -49,7 +49,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
$s = @curl_exec($ch); $s = @curl_exec($ch);
$base = $s; $base = $s;
$curl_info = curl_getinfo($ch); $curl_info = @curl_getinfo($ch);
$http_code = $curl_info['http_code']; $http_code = $curl_info['http_code'];
$header = ''; $header = '';
@ -80,7 +80,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
$a->set_curl_headers($header); $a->set_curl_headers($header);
curl_close($ch); @curl_close($ch);
return($body); return($body);
}} }}