Issue 6282: Update the contact data regularly (including the network)

This commit is contained in:
Michael 2019-01-16 21:39:56 +00:00
parent f13b8f8ec4
commit c359c162a7
5 changed files with 87 additions and 74 deletions

View file

@ -634,6 +634,8 @@ class Contact extends BaseObject
Logger::log('Empty contact: ' . json_encode($contact) . ' - ' . System::callstack(20), Logger::DEBUG);
}
Logger::log('Contact '.$contact['id'].' is marked for archival', Logger::DEBUG);
// Contact already archived or "self" contact? => nothing to do
if ($contact['archive'] || $contact['self']) {
return;
@ -682,6 +684,8 @@ class Contact extends BaseObject
return;
}
Logger::log('Contact '.$contact['id'].' is marked as vital again', Logger::DEBUG);
if (!isset($contact['url']) && !empty($contact['id'])) {
$fields = ['id', 'url', 'batch'];
$contact = DBA::selectFirst('contact', [], ['id' => $contact['id']]);
@ -1571,8 +1575,8 @@ class Contact extends BaseObject
$ret = Probe::uri($contact["url"], $network);
// If Probe::uri fails the network code will be different
if (($ret["network"] != $contact["network"]) && !in_array($ret["network"], [Protocol::ACTIVITYPUB, $network])) {
// If Probe::uri fails the network code will be different (mostly "feed" or "unkn")
if (($ret["network"] != $contact["network"]) && !in_array($ret["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, $network])) {
return false;
}

View file

@ -2370,7 +2370,7 @@ class Item extends BaseObject
$update = (!$arr['private'] && ((defaults($arr, 'author-link', '') === defaults($arr, 'owner-link', '')) || ($arr["parent-uri"] === $arr["uri"])));
// Is it a forum? Then we don't care about the rules from above
if (!$update && ($arr["network"] == Protocol::DFRN) && ($arr["parent-uri"] === $arr["uri"])) {
if (!$update && in_array($arr["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN]) && ($arr["parent-uri"] === $arr["uri"])) {
if (DBA::exists('contact', ['id' => $arr['contact-id'], 'forum' => true])) {
$update = true;
}