]> git.mxchange.org Git - friendica.git/commitdiff
Some correction stuff for old entries in the global contacts
authorMichael Vogel <icarus@dabo.de>
Tue, 28 Jul 2015 13:28:58 +0000 (15:28 +0200)
committerMichael Vogel <icarus@dabo.de>
Tue, 28 Jul 2015 13:28:58 +0000 (15:28 +0200)
include/discover_poco.php
include/socgraph.php

index 47c0cc2cd057a9f90fda4038bf4e33f3620da74f..d4564ae4a6ec90a8cbfe8375eab2de76414090d6 100644 (file)
@@ -87,8 +87,9 @@ function discover_users() {
        $users = q("SELECT `url`, `created`, `updated`, `last_failure`, `last_contact`, `server_url` FROM `gcontact`
                        WHERE `last_contact` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
                                `last_failure` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
-                               `network` IN ('%s', '%s', '%s') ORDER BY rand()",
-                       dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
+                               `network` IN ('%s', '%s', '%s', '%s', '') ORDER BY rand()",
+                       dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA),
+                       dbesc(NETWORK_OSTATUS), dbesc(NETWORK_FEED));
 
        if (!$users)
                return;
index 5671891df5e9f67696b5a3718773c8b7dcc2bd4e..5e7cded9c23006e934ca14e2efdfe31a82271b9e 100644 (file)
@@ -176,7 +176,7 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
        if (!isset($urlparts["scheme"]))
                return $gcid;
 
-       if (in_array($urlparts["host"], array("facebook.com", "twitter.com", "www.twitter-rss.com",
+       if (in_array($urlparts["host"], array("www.facebook.com", "facebook.com", "twitter.com",
                                                "identi.ca", "alpha.app.net")))
                return $gcid;
 
@@ -434,15 +434,41 @@ function poco_last_updated($profile, $force = false) {
                q("UPDATE `gcontact` SET `created` = '%s' WHERE `nurl` = '%s'",
                        dbesc(datetime_convert()), dbesc(normalise_link($profile)));
 
+       $urlparts = parse_url($profile);
+       if (!isset($urlparts["scheme"]))
+               return;
+
+       if (in_array($urlparts["host"], array("www.facebook.com", "facebook.com", "twitter.com",
+                                               "identi.ca", "alpha.app.net"))) {
+               q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
+                       dbesc(NETWORK_PHANTOM), dbesc(normalise_link($profile)));
+               return;
+       }
+
        if ($gcontacts[0]["server_url"] != "")
                $server_url = $gcontacts[0]["server_url"];
        else
                $server_url = poco_detect_server($profile);
 
-       if ($server_url != "")
+       if ($server_url != "") {
                if (!poco_check_server($server_url, $gcontacts[0]["network"]))
                        return false;
 
+               q("UPDATE `gcontact` SET `server_url` = '%s' WHERE `nurl` = '%s'",
+                       dbesc($server_url), dbesc(normalise_link($profile)));
+       }
+
+       if (in_array($gcontacts[0]["network"], array("", NETWORK_FEED))) {
+               $server = q("SELECT `network` FROM `gserver` WHERE `nurl` = '%s' AND `network` != ''",
+                       dbesc(normalise_link($server_url)));
+
+               if ($server)
+                       q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
+                               dbesc($server[0]["network"]), dbesc(normalise_link($profile)));
+               else
+                       return;
+       }
+
        // noscrape is really fast so we don't cache the call.
        if (($gcontacts[0]["server_url"] != "") AND ($gcontacts[0]["nick"] != "")) {