Removed query for "updated" in gcontact
This commit is contained in:
parent
6011598bc2
commit
cf0d36737f
|
@ -2563,7 +2563,8 @@ class Item
|
||||||
Contact::unmarkForArchival($contact);
|
Contact::unmarkForArchival($contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
$update = (($arr['private'] != self::PRIVATE) && ((($arr['author-link'] ?? '') === ($arr['owner-link'] ?? '')) || ($arr["parent-uri"] === $arr["uri"])));
|
/// @todo On private posts we could obfuscate the date
|
||||||
|
$update = ($arr['private'] != self::PRIVATE);
|
||||||
|
|
||||||
// Is it a forum? Then we don't care about the rules from above
|
// Is it a forum? Then we don't care about the rules from above
|
||||||
if (!$update && in_array($arr["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN]) && ($arr["parent-uri"] === $arr["uri"])) {
|
if (!$update && in_array($arr["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN]) && ($arr["parent-uri"] === $arr["uri"])) {
|
||||||
|
@ -2573,8 +2574,15 @@ class Item
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
|
// The "self" contact id is used (for example in the connectors) when the contact is unknown
|
||||||
['id' => $arr['contact-id']]);
|
// So we have to ensure to only update the last item when it had been our own post,
|
||||||
|
// or it had been done by a "regular" contact.
|
||||||
|
if (!empty($arr['wall'])) {
|
||||||
|
$condition = ['id' => $arr['contact-id']];
|
||||||
|
} else {
|
||||||
|
$condition = ['id' => $arr['contact-id'], 'self' => false];
|
||||||
|
}
|
||||||
|
DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']], $condition);
|
||||||
}
|
}
|
||||||
// Now do the same for the system wide contacts with uid=0
|
// Now do the same for the system wide contacts with uid=0
|
||||||
if ($arr['private'] != self::PRIVATE) {
|
if ($arr['private'] != self::PRIVATE) {
|
||||||
|
|
|
@ -398,18 +398,15 @@ class Profile
|
||||||
$contact_block = '';
|
$contact_block = '';
|
||||||
$updated = '';
|
$updated = '';
|
||||||
$contact_count = 0;
|
$contact_count = 0;
|
||||||
|
|
||||||
|
if (!empty($profile['last-item'])) {
|
||||||
|
$updated = date('c', strtotime($profile['last-item']));
|
||||||
|
}
|
||||||
|
|
||||||
if (!$block) {
|
if (!$block) {
|
||||||
$contact_block = ContactBlock::getHTML($a->profile);
|
$contact_block = ContactBlock::getHTML($a->profile);
|
||||||
|
|
||||||
if (is_array($a->profile) && !$a->profile['hide-friends']) {
|
if (is_array($a->profile) && !$a->profile['hide-friends']) {
|
||||||
$r = q(
|
|
||||||
"SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
|
|
||||||
intval($a->profile['uid'])
|
|
||||||
);
|
|
||||||
if (DBA::isResult($r)) {
|
|
||||||
$updated = date('c', strtotime($r[0]['updated']));
|
|
||||||
}
|
|
||||||
|
|
||||||
$contact_count = DBA::count('contact', [
|
$contact_count = DBA::count('contact', [
|
||||||
'uid' => $profile['uid'],
|
'uid' => $profile['uid'],
|
||||||
'self' => false,
|
'self' => false,
|
||||||
|
|
|
@ -85,22 +85,11 @@ class NoScrape extends BaseModule
|
||||||
$json_info['tags'] = $keywords;
|
$json_info['tags'] = $keywords;
|
||||||
$json_info['language'] = $a->profile['language'];
|
$json_info['language'] = $a->profile['language'];
|
||||||
|
|
||||||
if (!($a->profile['hide-friends'] ?? false)) {
|
if (!empty($a->profile['last-item'])) {
|
||||||
$stmt = DBA::p(
|
$json_info['updated'] = date("c", strtotime($a->profile['last-item']));
|
||||||
"SELECT `gcontact`.`updated`
|
}
|
||||||
FROM `contact`
|
|
||||||
INNER JOIN `gcontact`
|
|
||||||
WHERE `gcontact`.`nurl` = `contact`.`nurl`
|
|
||||||
AND `self`
|
|
||||||
AND `uid` = ?
|
|
||||||
LIMIT 1",
|
|
||||||
intval($a->profile['uid'])
|
|
||||||
);
|
|
||||||
if ($gcontact = DBA::fetch($stmt)) {
|
|
||||||
$json_info["updated"] = date("c", strtotime($gcontact['updated']));
|
|
||||||
}
|
|
||||||
DBA::close($stmt);
|
|
||||||
|
|
||||||
|
if (!($a->profile['hide-friends'] ?? false)) {
|
||||||
$json_info['contacts'] = DBA::count('contact',
|
$json_info['contacts'] = DBA::count('contact',
|
||||||
[
|
[
|
||||||
'uid' => $a->profile['uid'],
|
'uid' => $a->profile['uid'],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user