Merge pull request #11883 from annando/performance

Use AP data when possible
This commit is contained in:
Philipp 2022-09-04 18:22:07 +02:00 committed by GitHub
commit 2ad587faf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -96,7 +96,12 @@ class FContact
$uriid = ItemURI::insert(['uri' => $arr['url'], 'guid' => $arr['guid']]); $uriid = ItemURI::insert(['uri' => $arr['url'], 'guid' => $arr['guid']]);
$contact = Contact::getByUriId($uriid, ['id']); $contact = Contact::getByUriId($uriid, ['id']);
if (!empty($contact['id'])) { $apcontact = APContact::getByURL($arr['url'], false);
if (!empty($apcontact)) {
$interacted = $apcontact['following_count'];
$interacting = $apcontact['followers_count'];
$posts = $apcontact['statuses_count'];
} elseif (!empty($contact['id'])) {
$last_interaction = DateTimeFormat::utc('now - 180 days'); $last_interaction = DateTimeFormat::utc('now - 180 days');
$interacted = DBA::count('contact-relation', ["`cid` = ? AND NOT `follows` AND `last-interaction` > ?", $contact['id'], $last_interaction]); $interacted = DBA::count('contact-relation', ["`cid` = ? AND NOT `follows` AND `last-interaction` > ?", $contact['id'], $last_interaction]);

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2022.09-rc\n" "Project-Id-Version: 2022.09-rc\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-09-04 08:02+0000\n" "POT-Creation-Date: 2022-09-04 14:08+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"