It's really not supposed to be quite this chatty on the network - ah that's why. Oops.

This commit is contained in:
friendica 2013-01-28 20:51:37 -08:00
parent 95415bff69
commit 3cf3f7437e
2 changed files with 23 additions and 6 deletions

View file

@ -515,10 +515,15 @@ function get_item_elements($x) {
else
return array();
if(import_author_xchan($x['owner']))
$arr['owner_xchan'] = base64url_encode(hash('whirlpool',$x['owner']['guid'] . $x['owner']['guid_sig'], true));
else
return array();
// save a potentially expensive lookup if author == owner
if($arr['author_xchan'] === base64url_encode(hash('whirlpool',$x['owner']['guid'] . $x['owner']['guid_sig'], true)))
$arr['owner_xchan'] = $arr['author_xchan'];
else {
if(import_author_xchan($x['owner']))
$arr['owner_xchan'] = base64url_encode(hash('whirlpool',$x['owner']['guid'] . $x['owner']['guid_sig'], true));
else
return array();
}
return $arr;
@ -527,13 +532,20 @@ function get_item_elements($x) {
function import_author_xchan($x) {
$r = q("select hubloc_url from hubloc where hubloc_guid = '%s' and hubloc_guid_sig = '%s' and (hubloc_flags & %d) limit 1",
dbesc($x['guid']),
dbesc($x['guid_sig']),
intval(HUBLOG_FLAGS_PRIMARY)
intval(HUBLOC_FLAGS_PRIMARY)
);
if($r)
if($r) {
logger('import_author_xchan: in cache', LOGGER_DEBUG);
return true;
}
logger('import_author_xchan: entry not in cache - probing: ' . print_r($x,true), LOGGER_DEBUG);
$them = array('hubloc_url' => $x['url'],'xchan_guid' => $x['guid'], 'xchan_guid_sig' => $x['guid_sig']);
return zot_refresh($them);
}

View file

@ -730,6 +730,11 @@ function zot_import($arr) {
$data = json_decode($arr['body'],true);
if(! $data) {
logger('zot_import: empty body');
return array();
}
// logger('zot_import: data1: ' . print_r($data,true));
if(array_key_exists('iv',$data)) {