X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fsocgraph.php;h=7a39e388be8bba407ef3ba73fe11a39c1ea070ce;hb=34815de99c548b61c94b6e6939edd485eca728d6;hp=1d9f2adebabe9f5b2c9688ba5474597157815de7;hpb=a849a2547096401fb94ab424737670cb3709f36f;p=friendica.git diff --git a/include/socgraph.php b/include/socgraph.php index 1d9f2adeba..7a39e388be 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -1,20 +1,22 @@ loadHTML($body); - $xpath = new \DomXPath($doc); + $xpath = new DomXPath($doc); $list = $xpath->query("//meta[@name]"); @@ -1425,7 +1427,7 @@ function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = fal $r = q("SELECT `gcontact`.* FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` where `glink`.`zcid` = %d - and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) + and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) $sql_extra limit %d, %d", intval($zcid), intval($uid), @@ -1993,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 @@ -2034,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; } @@ -2340,4 +2339,3 @@ function poco_serverlist() { } return $r; } -?>