]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4526 from MrPetovan/task/4522-postpone-contact-update
authorMichael Vogel <icarus@dabo.de>
Fri, 2 Mar 2018 04:43:04 +0000 (05:43 +0100)
committerGitHub <noreply@github.com>
Fri, 2 Mar 2018 04:43:04 +0000 (05:43 +0100)
Postpone contact update in Contact::getIdForURL

boot.php
mod/admin.php
mod/item.php
src/Content/Text/BBCode.php
src/Content/Widget.php
src/Database/PostUpdate.php
src/Model/Item.php
src/Protocol/OStatus.php
util/global_community_block.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 1fa8cb2c021b56bb3a94777518b6ac2d4868efb4..967893e97479f7638ba1281a4472729d3be9228e 100644 (file)
@@ -384,7 +384,7 @@ function admin_page_contactblock_post(App $a)
        check_form_security_token_redirectOnErr('/admin/contactblock', 'admin_contactblock');
 
        if (x($_POST, 'page_contactblock_block')) {
-               $contact_id = Contact::getIdForURL($contact_url, 0);
+               $contact_id = Contact::getIdForURL($contact_url);
                if ($contact_id) {
                        Contact::block($contact_id);
                        notice(L10n::t('The contact has been blocked from the node'));
index 90598b7a3084debe8fd85bb4da90ace1cc9af2eb..8aa7c665af8733df7cbb873f35818698192f76fe 100644 (file)
@@ -593,11 +593,11 @@ function item_post(App $a) {
        $datarray['owner-name']    = $contact_record['name'];
        $datarray['owner-link']    = $contact_record['url'];
        $datarray['owner-avatar']  = $contact_record['thumb'];
-       $datarray['owner-id']      = Contact::getIdForURL($datarray['owner-link'], 0);
+       $datarray['owner-id']      = Contact::getIdForURL($datarray['owner-link']);
        $datarray['author-name']   = $author['name'];
        $datarray['author-link']   = $author['url'];
        $datarray['author-avatar'] = $author['thumb'];
-       $datarray['author-id']     = Contact::getIdForURL($datarray['author-link'], 0);
+       $datarray['author-id']     = Contact::getIdForURL($datarray['author-link']);
        $datarray['created']       = DateTimeFormat::utcNow();
        $datarray['edited']        = DateTimeFormat::utcNow();
        $datarray['commented']     = DateTimeFormat::utcNow();
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 9ff3a978761fa9c92e061af21a7c8d81ad8409c7..99974a4146218b57a91e749ffeed493ecb21c1b4 100644 (file)
@@ -162,8 +162,8 @@ class PostUpdate
 
         // Set the "author-id" and "owner-id" in the item table and add a new public contact entry if needed
         foreach ($item_arr as $item) {
-            $author_id = Contact::getIdForURL($item["author-link"], 0);
-            $owner_id = Contact::getIdForURL($item["owner-link"], 0);
+            $author_id = Contact::getIdForURL($item["author-link"]);
+            $owner_id = Contact::getIdForURL($item["owner-link"]);
 
             if ($author_id == 0)
                 $author_id = -1;
index 696860e16cffd4f5075e66a964645f2fa7346d59..d6257d99a17f566a1f414ed49234100e9f7f677b 100644 (file)
@@ -474,14 +474,14 @@ class Item extends BaseObject
                // The contact-id should be set before "self::insert" was called - but there seems to be issues sometimes
                $item["contact-id"] = self::contactId($item);
 
-               $item['author-id'] = defaults($item, 'author-id', Contact::getIdForURL($item["author-link"], 0));
+               $item['author-id'] = defaults($item, 'author-id', Contact::getIdForURL($item["author-link"]));
 
                if (Contact::isBlocked($item["author-id"])) {
                        logger('Contact '.$item["author-id"].' is blocked, item '.$item["uri"].' will not be stored');
                        return 0;
                }
 
-               $item['owner-id'] = defaults($item, 'owner-id', Contact::getIdForURL($item["owner-link"], 0));
+               $item['owner-id'] = defaults($item, 'owner-id', Contact::getIdForURL($item["owner-link"]));
 
                if (Contact::isBlocked($item["owner-id"])) {
                        logger('Contact '.$item["owner-id"].' is blocked, item '.$item["uri"].' will not be stored');
@@ -897,7 +897,7 @@ class Item extends BaseObject
                                $item['uid'] = 0;
                                $item['origin'] = 0;
                                $item['wall'] = 0;
-                               $item['contact-id'] = Contact::getIdForURL($item['author-link'], 0);
+                               $item['contact-id'] = Contact::getIdForURL($item['author-link']);
 
                                if (in_array($item['type'], ["net-comment", "wall-comment"])) {
                                        $item['type'] = 'remote-comment';
@@ -951,7 +951,7 @@ class Item extends BaseObject
                $item['uid'] = 0;
                $item['origin'] = 0;
                $item['wall'] = 0;
-               $item['contact-id'] = Contact::getIdForURL($item['author-link'], 0);
+               $item['contact-id'] = Contact::getIdForURL($item['author-link']);
 
                if (in_array($item['type'], ["net-comment", "wall-comment"])) {
                        $item['type'] = 'remote-comment';
@@ -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') {
index df50c827badabbe713a490c387aa1086c95b5c47..02f0c53ec0426ee6a9c21372e86ab235f1dcea1e 100755 (executable)
@@ -43,7 +43,7 @@ require_once '.htconfig.php';
 dba::connect($db_host, $db_user, $db_pass, $db_data);
 unset($db_host, $db_user, $db_pass, $db_data);
 
-$contact_id = Contact::getIdForURL($argv[1], 0);
+$contact_id = Contact::getIdForURL($argv[1]);
 if (!$contact_id) {
        echo L10n::t('Could not find any contact entry for this URL (%s)', $nurl);
        echo "\r\n";