X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fsocgraph.php;h=7a39e388be8bba407ef3ba73fe11a39c1ea070ce;hb=71a5de40f105234aa8082844d7839c3e0e49e905;hp=3de114fcabd9003ab252e27a7f62c96fedada763;hpb=6680ce1dd77b5b4b6fbfcd6d5b58b65710e52079;p=friendica.git diff --git a/include/socgraph.php b/include/socgraph.php index 3de114fcab..7a39e388be 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -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; }