Repair missing contact photos

This commit is contained in:
Matthew Exon 2020-01-09 21:41:52 +01:00 committed by Matthew Exon
parent 95e65e37ee
commit ae6748a465

View file

@ -1896,6 +1896,14 @@ class Contact
$data = [$contact["photo"], $contact["thumb"], $contact["micro"]];
}
foreach ($data as $image_uri) {
$image_rid = Photo::ridFromURI($image_uri);
if ($image_rid && !Photo::exists(['resource-id' => $image_rid, 'uid' => $uid])) {
Logger::info('Regenerating avatar for contact uid ' . $uid . ' cid ' . $cid . ' missing photo ' . $image_rid . ' avatar ' . $contact['avatar']);
$force = true;
}
}
if (($contact["avatar"] != $avatar) || $force) {
$photos = Photo::importProfilePhoto($avatar, $uid, $cid, true);