cloning abook entries was broken in several ways if the target xchan wasn't available on the clone site. This should make it less broken.
This commit is contained in:
parent
0689816772
commit
62df06b3d6
@ -971,6 +971,14 @@ function import_author_diaspora($x) {
|
|||||||
if(! $x['address'])
|
if(! $x['address'])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
$r = q("select * from xchan where xchan_addr = '%s' limit 1",
|
||||||
|
dbesc($x['address'])
|
||||||
|
);
|
||||||
|
if($r) {
|
||||||
|
logger('in_cache: ' . $x['address'], LOGGER_DATA);
|
||||||
|
return $r[0]['chan_hash'];
|
||||||
|
}
|
||||||
|
|
||||||
if(discover_by_webbie($x['address'])) {
|
if(discover_by_webbie($x['address'])) {
|
||||||
$r = q("select xchan_hash from xchan where xchan_addr = '%s' limit 1",
|
$r = q("select xchan_hash from xchan where xchan_addr = '%s' limit 1",
|
||||||
dbesc($x['address'])
|
dbesc($x['address'])
|
||||||
|
@ -2926,25 +2926,14 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
|
|||||||
|
|
||||||
// Perform discovery if the referenced xchan hasn't ever been seen on this hub.
|
// Perform discovery if the referenced xchan hasn't ever been seen on this hub.
|
||||||
// This relies on the undocumented behaviour that red sites send xchan info with the abook
|
// This relies on the undocumented behaviour that red sites send xchan info with the abook
|
||||||
|
// and import_author_xchan will look them up on all federated networks
|
||||||
|
|
||||||
if($abook['abook_xchan'] && $abook['xchan_address']) {
|
if($abook['abook_xchan'] && $abook['xchan_addr']) {
|
||||||
$h = zot_get_hublocs($abook['abook_xchan']);
|
$h = zot_get_hublocs($abook['abook_xchan']);
|
||||||
if(! $h) {
|
if(! $h) {
|
||||||
$f = zot_finger($abook['xchan_address'],$channel);
|
$xhash = import_author_xchan(encode_item_xchan($abook));
|
||||||
if(! $f['success']) {
|
if(! $xhash) {
|
||||||
logger('process_channel_sync_delivery: abook not probe-able' . $abook['xchan_address']);
|
logger('process_channel_sync_delivery: import of ' . $abook['xchan_addr'] . ' failed.');
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$j = json_decode($f['body'],true);
|
|
||||||
if(! ($j['success'] && $j['guid'])) {
|
|
||||||
logger('process_channel_sync_delivery: probe failed.');
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$x = import_xchan($j);
|
|
||||||
|
|
||||||
if(! $x['success']) {
|
|
||||||
logger('process_channel_sync_delivery: import failed.');
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user