It's really not supposed to be quite this chatty on the network - ah that's why. Oops.
This commit is contained in:
parent
95415bff69
commit
3cf3f7437e
@ -515,10 +515,15 @@ function get_item_elements($x) {
|
|||||||
else
|
else
|
||||||
return array();
|
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']))
|
if(import_author_xchan($x['owner']))
|
||||||
$arr['owner_xchan'] = base64url_encode(hash('whirlpool',$x['owner']['guid'] . $x['owner']['guid_sig'], true));
|
$arr['owner_xchan'] = base64url_encode(hash('whirlpool',$x['owner']['guid'] . $x['owner']['guid_sig'], true));
|
||||||
else
|
else
|
||||||
return array();
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
@ -527,13 +532,20 @@ function get_item_elements($x) {
|
|||||||
|
|
||||||
|
|
||||||
function import_author_xchan($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",
|
$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']),
|
||||||
dbesc($x['guid_sig']),
|
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;
|
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']);
|
$them = array('hubloc_url' => $x['url'],'xchan_guid' => $x['guid'], 'xchan_guid_sig' => $x['guid_sig']);
|
||||||
return zot_refresh($them);
|
return zot_refresh($them);
|
||||||
}
|
}
|
||||||
|
@ -730,6 +730,11 @@ function zot_import($arr) {
|
|||||||
|
|
||||||
$data = json_decode($arr['body'],true);
|
$data = json_decode($arr['body'],true);
|
||||||
|
|
||||||
|
if(! $data) {
|
||||||
|
logger('zot_import: empty body');
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
// logger('zot_import: data1: ' . print_r($data,true));
|
// logger('zot_import: data1: ' . print_r($data,true));
|
||||||
|
|
||||||
if(array_key_exists('iv',$data)) {
|
if(array_key_exists('iv',$data)) {
|
||||||
|
Reference in New Issue
Block a user