X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FPortableContact.php;h=cfc140d66d9a45e03993010e1e29a6b2972ae3bf;hb=f4e1acedfcd86c81403c14747ecfd3b11583506e;hp=4ff9ae98bf45b77b7f4d7cb2c22f50af1e435738;hpb=85dc9bb96b30819fcf544c9aa1013a8f380d6981;p=friendica.git diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php index 4ff9ae98bf..cfc140d66d 100644 --- a/src/Protocol/PortableContact.php +++ b/src/Protocol/PortableContact.php @@ -31,7 +31,6 @@ use Friendica\DI; use Friendica\Model\GContact; use Friendica\Model\GServer; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Network; use Friendica\Util\Strings; /** @@ -99,11 +98,11 @@ class PortableContact return; } - $url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation'); + $url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation'); Logger::log('load: ' . $url, Logger::DEBUG); - $fetchresult = Network::fetchUrlFull($url); + $fetchresult = DI::httpRequest()->fetchFull($url); $s = $fetchresult->getBody(); Logger::log('load: returns ' . $s, Logger::DATA); @@ -116,7 +115,7 @@ class PortableContact $j = json_decode($s, true); - Logger::log('load: json: ' . print_r($j, true), Logger::DATA); + Logger::debug('load', ['json' => $j]); if (!isset($j['entry'])) { return; @@ -134,7 +133,6 @@ class PortableContact $location = ''; $about = ''; $keywords = ''; - $gender = ''; $contact_type = -1; $generation = 0; @@ -179,10 +177,6 @@ class PortableContact $about = HTML::toBBCode($entry['aboutMe']); } - if (isset($entry['gender'])) { - $gender = $entry['gender']; - } - if (isset($entry['generation']) && ($entry['generation'] > 0)) { $generation = ++$entry['generation']; } @@ -203,7 +197,6 @@ class PortableContact "photo" => $profile_photo, "about" => $about, "location" => $location, - "gender" => $gender, "keywords" => $keywords, "connect" => $connect_url, "updated" => $updated, @@ -234,7 +227,7 @@ class PortableContact { $r = q( "SELECT `url`, `site_name` AS `displayName`, `network`, `platform`, `version` FROM `gserver` - WHERE `network` IN ('%s', '%s', '%s') AND `last_contact` > `last_failure` + WHERE `network` IN ('%s', '%s', '%s') AND NOT `failed` ORDER BY `last_contact` LIMIT 1000", DBA::escape(Protocol::DFRN), @@ -257,7 +250,7 @@ class PortableContact */ private static function fetchServerlist($poco) { - $curlResult = Network::curl($poco . "/@server"); + $curlResult = DI::httpRequest()->get($poco . "/@server"); if (!$curlResult->isSuccess()) { return; @@ -293,11 +286,11 @@ class PortableContact self::fetchServerlist($server["poco"]); // Fetch all users from the other server - $url = $server["poco"] . "/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; + $url = $server["poco"] . "/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation"; Logger::info("Fetch all users from the server " . $server["url"]); - $curlResult = Network::curl($url); + $curlResult = DI::httpRequest()->get($url); if ($curlResult->isSuccess() && !empty($curlResult->getBody())) { $data = json_decode($curlResult->getBody(), true); @@ -316,11 +309,11 @@ class PortableContact $updatedSince = date(DateTimeFormat::MYSQL, time() - $timeframe * 86400); // Fetch all global contacts from the other server (Not working with Redmatrix and Friendica versions before 3.3) - $url = $server["poco"]."/@global?updatedSince=".$updatedSince."&fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; + $url = $server["poco"]."/@global?updatedSince=".$updatedSince."&fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation"; $success = false; - $curlResult = Network::curl($url); + $curlResult = DI::httpRequest()->get($url); if ($curlResult->isSuccess() && !empty($curlResult->getBody())) { Logger::info("Fetch all global contacts from the server " . $server["nurl"]); @@ -376,9 +369,9 @@ class PortableContact Logger::log('Fetch contacts for the user ' . $username . ' from the server ' . $server['nurl'], Logger::DEBUG); // Fetch all contacts from a given user from the other server - $url = $server['poco'] . '/' . $username . '/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation'; + $url = $server['poco'] . '/' . $username . '/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation'; - $curlResult = Network::curl($url); + $curlResult = DI::httpRequest()->get($url); if ($curlResult->isSuccess()) { $data = json_decode($curlResult->getBody(), true); @@ -409,7 +402,6 @@ class PortableContact $location = ''; $about = ''; $keywords = ''; - $gender = ''; $contact_type = -1; $generation = $default_generation; @@ -455,10 +447,6 @@ class PortableContact $about = HTML::toBBCode($entry['aboutMe']); } - if (isset($entry['gender'])) { - $gender = $entry['gender']; - } - if (isset($entry['generation']) && ($entry['generation'] > 0)) { $generation = ++$entry['generation']; } @@ -484,7 +472,6 @@ class PortableContact "photo" => $profile_photo, "about" => $about, "location" => $location, - "gender" => $gender, "keywords" => $keywords, "connect" => $connect_url, "updated" => $updated,