]> git.mxchange.org Git - friendica.git/blobdiff - include/socgraph.php
The index mustn't be 192 characters long
[friendica.git] / include / socgraph.php
index 3de114fcabd9003ab252e27a7f62c96fedada763..7a39e388be8bba407ef3ba73fe11a39c1ea070ce 100644 (file)
@@ -890,9 +890,9 @@ function poco_fetch_nodeinfo($server_url) {
 function poco_detect_server_type($body) {
        $server = false;
 
-       $doc = new \DOMDocument();
+       $doc = new DOMDocument();
        @$doc->loadHTML($body);
-       $xpath = new \DomXPath($doc);
+       $xpath = new DomXPath($doc);
 
        $list = $xpath->query("//meta[@name]");
 
@@ -1995,10 +1995,11 @@ function get_gcontact_id($contact) {
        if (in_array($contact["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
                $contact["url"] = clean_contact_url($contact["url"]);
 
-       $r = q("SELECT `id`, `last_contact`, `last_failure`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 2",
+       dba::lock('gcontact');
+       $r = q("SELECT `id`, `last_contact`, `last_failure`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
                dbesc(normalise_link($contact["url"])));
 
-       if ($r) {
+       if (dbm::is_result($r)) {
                $gcontact_id = $r[0]["id"];
 
                // Update every 90 days
@@ -2036,17 +2037,13 @@ function get_gcontact_id($contact) {
                        $doprobing = in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""));
                }
        }
+       dba::unlock();
 
        if ($doprobing) {
                logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
                proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"]));
        }
 
-       if ((dbm::is_result($r)) AND (count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != ""))
-        q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d",
-               dbesc(normalise_link($contact["url"])),
-               intval($gcontact_id));
-
        return $gcontact_id;
 }