Store avatar cache fields only when needed

This commit is contained in:
Michael 2020-07-25 11:48:52 +00:00
parent 398e65d66b
commit 9b86f40a5f
8 changed files with 52 additions and 19 deletions

View file

@ -1680,11 +1680,11 @@ class DFRN
$condition = ['uid' => 0, 'nurl' => Strings::normaliseLink($contact_old['url'])];
DBA::update('contact', $fields, $condition, true);
Contact::updateAvatar($author['avatar'], $importer['importer_uid'], $contact['id']);
Contact::updateAvatar($contact['id'], $author['avatar']);
$pcid = Contact::getIdForURL($contact_old['url']);
if (!empty($pcid)) {
Contact::updateAvatar($author['avatar'], 0, $pcid);
Contact::updateAvatar($pcid, $author['avatar']);
}
/*
@ -1962,7 +1962,7 @@ class DFRN
DBA::update('contact', $fields, $condition);
Contact::updateAvatar($relocate["avatar"], $importer["importer_uid"], $importer["id"], true);
Contact::updateAvatar($importer["id"], $relocate["avatar"], true);
Logger::log('Contacts are updated.');

View file

@ -2410,7 +2410,7 @@ class Diaspora
$image_url = "http://".$handle_parts[1].$image_url;
}
Contact::updateAvatar($image_url, $importer["uid"], $contact["id"]);
Contact::updateAvatar($contact["id"], $image_url);
// Generic birthday. We don't know the timezone. The year is irrelevant.

View file

@ -216,7 +216,7 @@ class OStatus
if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) {
Logger::log("Update profile picture for contact ".$contact["id"], Logger::DEBUG);
Contact::updateAvatar($author["author-avatar"], $importer["uid"], $contact["id"]);
Contact::updateAvatar($contact["id"], $author["author-avatar"]);
}
// Ensure that we are having this contact (with uid=0)
@ -237,7 +237,7 @@ class OStatus
// Update the avatar
if (!empty($author["author-avatar"])) {
Contact::updateAvatar($author["author-avatar"], 0, $cid);
Contact::updateAvatar($cid, $author["author-avatar"]);
}
}