Always update on missing uri-id, check for uri-id in contact before removal
This commit is contained in:
parent
377bb78cc2
commit
88f147c6a7
2 changed files with 16 additions and 3 deletions
|
@ -2027,8 +2027,8 @@ class Contact
|
||||||
// These fields aren't updated by this routine:
|
// These fields aren't updated by this routine:
|
||||||
// 'xmpp', 'sensitive'
|
// 'xmpp', 'sensitive'
|
||||||
|
|
||||||
$fields = ['uid', 'avatar', 'header', 'name', 'nick', 'location', 'keywords', 'about', 'subscribe',
|
$fields = ['uid', 'uri-id', 'avatar', 'header', 'name', 'nick', 'location', 'keywords', 'about', 'subscribe',
|
||||||
'manually-approve', 'unsearchable', 'url', 'addr', 'batch', 'notify', 'poll', 'request', 'confirm', 'poco',
|
'manually-approve', 'unsearchable', 'url', 'guid', 'addr', 'batch', 'notify', 'poll', 'request', 'confirm', 'poco',
|
||||||
'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey', 'last-item'];
|
'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey', 'last-item'];
|
||||||
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
|
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
|
@ -2056,6 +2056,9 @@ class Contact
|
||||||
$uid = $contact['uid'];
|
$uid = $contact['uid'];
|
||||||
unset($contact['uid']);
|
unset($contact['uid']);
|
||||||
|
|
||||||
|
$uriid = $contact['uri-id'];
|
||||||
|
unset($contact['uri-id']);
|
||||||
|
|
||||||
$pubkey = $contact['pubkey'];
|
$pubkey = $contact['pubkey'];
|
||||||
unset($contact['pubkey']);
|
unset($contact['pubkey']);
|
||||||
|
|
||||||
|
@ -2128,6 +2131,10 @@ class Contact
|
||||||
unset($ret['last-item']);
|
unset($ret['last-item']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($uriid)) {
|
||||||
|
$update = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($ret['photo']) && ($ret['network'] != Protocol::FEED)) {
|
if (!empty($ret['photo']) && ($ret['network'] != Protocol::FEED)) {
|
||||||
self::updateAvatar($id, $ret['photo'], $update);
|
self::updateAvatar($id, $ret['photo'], $update);
|
||||||
}
|
}
|
||||||
|
@ -2150,8 +2157,13 @@ class Contact
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($ret['guid'])) {
|
||||||
|
$ret['uri-id'] = ItemURI::getIdByURI($ret['url']);
|
||||||
|
} else {
|
||||||
|
$ret['uri-id'] = ItemURI::insert(['uri' => $ret['uri'], 'guid' => $ret['guid']]);
|
||||||
|
}
|
||||||
|
|
||||||
$ret['nurl'] = Strings::normaliseLink($ret['url']);
|
$ret['nurl'] = Strings::normaliseLink($ret['url']);
|
||||||
$ret['uri-id'] = ItemURI::getIdByURI($ret['url']);
|
|
||||||
$ret['updated'] = $updated;
|
$ret['updated'] = $updated;
|
||||||
$ret['failed'] = false;
|
$ret['failed'] = false;
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ class ExpirePosts
|
||||||
AND NOT EXISTS(SELECT `external-id` FROM `post-user` WHERE `external-id` = `item-uri`.`id`)
|
AND NOT EXISTS(SELECT `external-id` FROM `post-user` WHERE `external-id` = `item-uri`.`id`)
|
||||||
AND NOT EXISTS(SELECT `uri-id` FROM `mail` WHERE `uri-id` = `item-uri`.`id`)
|
AND NOT EXISTS(SELECT `uri-id` FROM `mail` WHERE `uri-id` = `item-uri`.`id`)
|
||||||
AND NOT EXISTS(SELECT `uri-id` FROM `event` WHERE `uri-id` = `item-uri`.`id`)
|
AND NOT EXISTS(SELECT `uri-id` FROM `event` WHERE `uri-id` = `item-uri`.`id`)
|
||||||
|
AND NOT EXISTS(SELECT `uri-id` FROM `contact` WHERE `uri-id` = `item-uri`.`id`)
|
||||||
AND NOT EXISTS(SELECT `parent-uri-id` FROM `mail` WHERE `parent-uri-id` = `item-uri`.`id`)
|
AND NOT EXISTS(SELECT `parent-uri-id` FROM `mail` WHERE `parent-uri-id` = `item-uri`.`id`)
|
||||||
AND NOT EXISTS(SELECT `thr-parent-id` FROM `mail` WHERE `thr-parent-id` = `item-uri`.`id`)", $item['uri-id']]);
|
AND NOT EXISTS(SELECT `thr-parent-id` FROM `mail` WHERE `thr-parent-id` = `item-uri`.`id`)", $item['uri-id']]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue