From: Michael Date: Mon, 8 Apr 2019 21:05:33 +0000 (+0000) Subject: Update the contact in the background X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c088249e1bb85323fccafe314a433fe2a422f43e;p=friendica.git Update the contact in the background --- diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 2072044b30..2916cf1bb2 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1254,6 +1254,12 @@ class Contact extends BaseObject if (empty($contact['avatar'])) { $update_contact = true; } + + // Update the contact in the background if needed + if ($update_contact && $no_update) { + Worker::add(PRIORITY_LOW, "UpdateContact", $contact_id); + } + if (!$update_contact || $no_update) { return $contact_id; } @@ -1265,8 +1271,10 @@ class Contact extends BaseObject // When we don't want to update, we look if we know this contact in any way if ($no_update && empty($default)) { $data = self::getProbeDataFromDatabase($url); + $background_update = true; } else { $data = []; + $background_update = false; } if (empty($data)) { @@ -1345,6 +1353,11 @@ class Contact extends BaseObject $contact_id = $contacts[0]["id"]; + // Update in the background when we fetched the data solely from the database + if ($background_update) { + Worker::add(PRIORITY_LOW, "UpdateContact", $contact_id); + } + // Update the newly created contact from data in the gcontact table $gcontact = DBA::selectFirst('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => Strings::normaliseLink($data["url"])]); if (DBA::isResult($gcontact)) {