]> git.mxchange.org Git - friendica.git/commitdiff
Add no_update flag to speed up Contact::getIdForURL instances
authorHypolite Petovan <mrpetovan@gmail.com>
Fri, 2 Mar 2018 00:54:45 +0000 (19:54 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Fri, 2 Mar 2018 00:54:45 +0000 (19:54 -0500)
boot.php
src/Content/Text/BBCode.php
src/Content/Widget.php
src/Model/Item.php
src/Protocol/OStatus.php

index 472814a6db546d9a07e41732bc43533982249a69..4ba8c1ad8df74d6b16fdb46a7c3820acc588a01a 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -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;
index 9f250e9bfa3ee454fa01af18aeddcb6b624200c7..8dd9305ca316f263f98503304ef59492b868eaed 100644 (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);
 
index d2572429851188282071a039f2f37a2dd2dfa509..058a7a1fb51c47e82bc2e00e1e299bd03829427c 100644 (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 '';
index 926552a17e6b7e24e008f483fcbd1e07451decba..d6257d99a17f566a1f414ed49234100e9f7f677b 100644 (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);
index a3fdacf33145ca6b0a5c4df02f42ae1e67d6fe6c..c6f840a66e0b60150f9d57b0574e26df51b88527 100644 (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') {