]> git.mxchange.org Git - friendica.git/commitdiff
Remove reduncancies
authorMichael <heluecht@pirati.ca>
Wed, 22 Mar 2017 05:26:44 +0000 (05:26 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 22 Mar 2017 05:26:44 +0000 (05:26 +0000)
include/dfrn.php
include/diaspora.php
include/discover_poco.php
include/ostatus.php
include/socgraph.php

index 25f8c9358e2047bd324fe1081b72360bf151c3f4..0e3cdf76f7eaa301b338d1672dca7163b69ec029 100644 (file)
@@ -1352,7 +1352,9 @@ class dfrn {
                        $poco["photo"] = $author["avatar"];
                        $poco["hide"] = $hide;
                        $poco["contact-type"] = $contact["contact-type"];
-                       update_gcontact($poco);
+                       $gcid = update_gcontact($poco);
+
+                       link_gcontact($gcid, $importer["uid"], $contact["id"]);
                }
 
                return($author);
index eca22092d81352987a2a8a0e6981c8c7aa3fb206..841ba7e7ff15c647ba1929dd77f3492af8f81a4c 100644 (file)
@@ -1848,18 +1848,15 @@ class Diaspora {
                        intval($importer["uid"])
                );
 
-               if ($searchable) {
-                       poco_check($contact["url"], $name, NETWORK_DIASPORA, $image_url, $about, $location, $gender, $keywords, "",
-                               datetime_convert(), 2, $contact["id"], $importer["uid"]);
-               }
-
                $gcontact = array("url" => $contact["url"], "network" => NETWORK_DIASPORA, "generation" => 2,
                                        "photo" => $image_url, "name" => $name, "location" => $location,
                                        "about" => $about, "birthday" => $birthday, "gender" => $gender,
                                        "addr" => $author, "nick" => $nick, "keywords" => $keywords,
                                        "hide" => !$searchable, "nsfw" => $nsfw);
 
-               update_gcontact($gcontact);
+               $gcid = update_gcontact($gcontact);
+
+               link_gcontact($gcid, $importer["uid"], $contact["id"]);
 
                logger("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], LOGGER_DEBUG);
 
index d203cfd6b43b6458f8d8e1bf6aaef194f69d7ba3..3dba1f3215418d8d86617402616a74bcec5be79f 100644 (file)
@@ -266,6 +266,7 @@ function gs_search_user($search) {
                return false;
        }
        foreach($contacts->data AS $user) {
+               //update_gcontact_from_probe($user->site_address."/".$user->name);
                $contact = probe_url($user->site_address."/".$user->name);
                if ($contact["network"] != NETWORK_PHANTOM) {
                        $contact["about"] = $user->description;
index 2c4b677a53af99bf5316cc9ca8caa8a512ac5802..931ea870fcf88745afccbce9fd8ae2f941cef606 100644 (file)
@@ -132,9 +132,6 @@ class ostatus {
                                        dbesc($contact["name"]), dbesc($contact["nick"]), dbesc($contact["alias"]),
                                        dbesc($contact["about"]), dbesc($contact["location"]),
                                        dbesc(datetime_convert()), intval($contact["id"]));
-
-                               poco_check($contact["url"], $contact["name"], $contact["network"], $author["author-avatar"], $contact["about"], $contact["location"],
-                                                       "", "", "", datetime_convert(), 2, $contact["id"], $contact["uid"]);
                        }
 
                        if (isset($author["author-avatar"]) AND ($author["author-avatar"] != $r[0]['avatar'])) {
@@ -163,7 +160,9 @@ class ostatus {
                        $contact["generation"] = 2;
                        $contact["hide"] = false; // OStatus contacts are never hidden
                        $contact["photo"] = $author["author-avatar"];
-                       update_gcontact($contact);
+                       $gcid = update_gcontact($contact);
+
+                       link_gcontact($gcid, $contact["uid"], $contact["id"]);
                }
 
                return($author);
index 71771bb95d909eb8c9ded6b89c2c5de5b26c5608..2634c3ddcf4a6346e0a76295c0d08cd0f7215a9e 100644 (file)
@@ -357,14 +357,20 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
        if(!$gcid)
                return $gcid;
 
+       link_gcontact($gcid, $uid, $cid, $zcid);
+
+       return $gcid;
+}
+
+function link_gcontact($gcid, $uid = 0, $cid = 0, $zcid = 0) {
        $r = q("SELECT * FROM `glink` WHERE `cid` = %d AND `uid` = %d AND `gcid` = %d AND `zcid` = %d LIMIT 1",
                intval($cid),
                intval($uid),
                intval($gcid),
                intval($zcid)
        );
-       if (! dbm::is_result($r)) {
-               q("INSERT INTO `glink` (`cid`,`uid`,`gcid`,`zcid`, `updated`) VALUES (%d,%d,%d,%d, '%s') ",
+       if (!dbm::is_result($r)) {
+               q("INSERT INTO `glink` (`cid`, `uid`, `gcid`, `zcid`, `updated`) VALUES (%d, %d, %d, %d, '%s') ",
                        intval($cid),
                        intval($uid),
                        intval($gcid),
@@ -380,8 +386,6 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
                        intval($zcid)
                );
        }
-
-       return $gcid;
 }
 
 function poco_reachable($profile, $server = "", $network = "", $force = false) {