hubzilla issue 1599 - get_author_zot() bypassing check for any living clones (leading to item import failure) if primary xchan/hubloc is both dead and never seen before. Previously it only checked for living clones if the primary was dead, but the dead state was only known if it had been seen before.

This commit is contained in:
nobody 2021-08-26 02:56:37 -07:00
parent d4fcd3b611
commit b2f8c08c3c

View file

@ -3004,21 +3004,26 @@ class Libzot {
$desturl = $x['url'];
$found_primary = false;
$r1 = q("select hubloc_url, hubloc_updated, site_dead from hubloc left join site on
hubloc_url = site_url where hubloc_guid = '%s' and hubloc_guid_sig = '%s' and hubloc_primary = 1 limit 1",
dbesc($x['id']),
dbesc($x['id_sig'])
);
if ($r1) {
$found_primary = true;
}
$r2 = q("select xchan_hash from xchan where xchan_guid = '%s' and xchan_guid_sig = '%s' limit 1",
dbesc($x['id']),
dbesc($x['id_sig'])
);
$site_dead = false;
$primary_dead = false;
if ($r1 && intval($r1[0]['site_dead'])) {
$site_dead = true;
$primary_dead = true;
}
// We have valid and somewhat fresh information. Always true if it is our own site.
@ -3036,8 +3041,8 @@ class Libzot {
// cached entry and the identity is valid. It's just unreachable until they bring back their
// server from the grave or create another clone elsewhere.
if ($site_dead) {
logger('dead site - ignoring', LOGGER_DEBUG,LOG_INFO);
if ($primary_dead || ! $found_primary) {
logger('dead or site - ignoring', LOGGER_DEBUG,LOG_INFO);
$r = q("select hubloc_id_url from hubloc left join site on hubloc_url = site_url
where hubloc_hash = '%s' and site_dead = 0",