Browse Source

Add no_update flag to speed up Contact::getIdForURL instances

pull/4526/head
Hypolite Petovan 3 years ago
parent
commit
41678ec3cd
5 changed files with 7 additions and 7 deletions
  1. +2
    -2
      boot.php
  2. +1
    -1
      src/Content/Text/BBCode.php
  3. +1
    -1
      src/Content/Widget.php
  4. +1
    -1
      src/Model/Item.php
  5. +2
    -2
      src/Protocol/OStatus.php

+ 2
- 2
boot.php View File

@ -925,10 +925,10 @@ function public_contact()
if (!$public_contact_id && x($_SESSION, 'authenticated')) {
if (x($_SESSION, 'my_address')) {
// Local user
$public_contact_id = intval(Contact::getIdForURL($_SESSION['my_address'], 0));
$public_contact_id = intval(Contact::getIdForURL($_SESSION['my_address'], 0, true));
} elseif (x($_SESSION, 'visitor_home')) {
// Remote user
$public_contact_id = intval(Contact::getIdForURL($_SESSION['visitor_home'], 0));
$public_contact_id = intval(Contact::getIdForURL($_SESSION['visitor_home'], 0, true));
}
} elseif (!x($_SESSION, 'authenticated')) {
$public_contact_id = false;


+ 1
- 1
src/Content/Text/BBCode.php View File

@ -1077,7 +1077,7 @@ class BBCode
// We only call this so that a previously unknown contact can be added.
// This is important for the function "Model\Contact::getDetailsByURL()".
// This function then can fetch an entry from the contact table.
Contact::getIdForURL($profile, 0);
Contact::getIdForURL($profile, 0, true);
$data = Contact::getDetailsByURL($profile);


+ 1
- 1
src/Content/Widget.php View File

@ -330,7 +330,7 @@ class Widget
}
if (Feature::isEnabled($a->profile['profile_uid'], 'tagadelic')) {
$owner_id = Contact::getIdForURL($a->profile['url']);
$owner_id = Contact::getIdForURL($a->profile['url'], 0, true);
if (!$owner_id) {
return '';


+ 1
- 1
src/Model/Item.php View File

@ -1723,7 +1723,7 @@ class Item extends BaseObject
$item_contact_id = $owner_self_contact['id'];
$item_contact = $owner_self_contact;
} else {
$item_contact_id = Contact::getIdForURL($author_contact['url'], $uid);
$item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
$item_contact = dba::selectFirst('contact', [], ['id' => $item_contact_id]);
if (!DBM::is_result($item_contact)) {
logger('like: unknown item contact ' . $item_contact_id);


+ 2
- 2
src/Protocol/OStatus.php View File

@ -186,7 +186,7 @@ class OStatus
}
// Ensure that we are having this contact (with uid=0)
$cid = Contact::getIdForURL($aliaslink, 0);
$cid = Contact::getIdForURL($aliaslink, 0, true);
if ($cid) {
$fields = ['url', 'nurl', 'name', 'nick', 'alias', 'about', 'location'];
@ -2108,7 +2108,7 @@ class OStatus
}
$check_date = DateTimeFormat::utc($last_update);
$authorid = Contact::getIdForURL($owner["url"], 0);
$authorid = Contact::getIdForURL($owner["url"], 0, true);
$sql_extra = '';
if ($filter === 'posts') {


Loading…
Cancel
Save