X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FProbe.php;h=1bc0f9d630b7d1c7213a0c33493fdaa65c82bcf7;hb=4a22710b3bd82143ab4e012e84d995d3768f7c50;hp=e0c645565b4018eecce84657b0f0afe8240023b7;hpb=b6a1df0598b5b67a3d0482962014090ff82f29f0;p=friendica.git diff --git a/src/Network/Probe.php b/src/Network/Probe.php index e0c645565b..1bc0f9d630 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -13,8 +13,8 @@ use DOMDocument; use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\System; -use Friendica\Database\dba; -use Friendica\Database\DBM; +use Friendica\Database\DBA; +use Friendica\Model\Contact; use Friendica\Model\Profile; use Friendica\Protocol\Email; use Friendica\Protocol\Feed; @@ -119,7 +119,7 @@ class Probe if (!is_object($xrd)) { $ret = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']); - if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { + if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { logger("Probing timeout for ".$url, LOGGER_DEBUG); return false; } @@ -398,7 +398,7 @@ class Probe // This doesn't cover the case when a community isn't a community anymore if (!empty($data['community']) && $data['community']) { $fields['community'] = $data['community']; - $fields['contact-type'] = ACCOUNT_TYPE_COMMUNITY; + $fields['contact-type'] = Contact::ACCOUNT_TYPE_COMMUNITY; } $fieldnames = []; @@ -411,11 +411,11 @@ class Probe } } - $fields['updated'] = DBM::date(); + $fields['updated'] = DateTimeFormat::utcNow(); $condition = ['nurl' => normalise_link($data["url"])]; - $old_fields = dba::selectFirst('gcontact', $fieldnames, $condition); + $old_fields = DBA::selectFirst('gcontact', $fieldnames, $condition); // When the gcontact doesn't exist, the value "true" will trigger an insert. // In difference to the public contacts we want to have every contact @@ -428,7 +428,7 @@ class Probe $fields['created'] = DateTimeFormat::utcNow(); } - dba::update('gcontact', $fields, $condition, $old_fields); + DBA::update('gcontact', $fields, $condition, $old_fields); $fields = ['name' => $data['name'], 'nick' => $data['nick'], @@ -448,7 +448,7 @@ class Probe 'pubkey' => $data['pubkey'], 'priority' => $data['priority'], 'writable' => true, - 'rel' => CONTACT_IS_SHARING]; + 'rel' => Contact::SHARING]; $fieldnames = []; @@ -466,13 +466,13 @@ class Probe // This won't trigger an insert. This is intended, since we only need // public contacts for everyone we store items from. // We don't need to store every contact on the planet. - $old_fields = dba::selectFirst('contact', $fieldnames, $condition); + $old_fields = DBA::selectFirst('contact', $fieldnames, $condition); $fields['name-date'] = DateTimeFormat::utcNow(); $fields['uri-date'] = DateTimeFormat::utcNow(); $fields['success_update'] = DateTimeFormat::utcNow(); - dba::update('contact', $fields, $condition, $old_fields); + DBA::update('contact', $fields, $condition, $old_fields); } } @@ -731,7 +731,7 @@ class Probe $redirects = 0; $ret = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => $type]); - if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { + if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { return false; } $data = $ret['body']; @@ -798,7 +798,7 @@ class Probe private static function pollNoscrape($noscrape_url, $data) { $ret = Network::curl($noscrape_url); - if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { + if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { return false; } $content = $ret['body']; @@ -1036,7 +1036,7 @@ class Probe private static function pollHcard($hcard_url, $data, $dfrn = false) { $ret = Network::curl($hcard_url); - if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { + if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { return false; } $content = $ret['body']; @@ -1283,7 +1283,7 @@ class Probe } } elseif (normalise_link($pubkey) == 'http://') { $ret = Network::curl($pubkey); - if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { + if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { return false; } $pubkey = $ret['body']; @@ -1315,7 +1315,7 @@ class Probe // Fetch all additional data from the feed $ret = Network::curl($data["poll"]); - if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { + if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { return false; } $feed = $ret['body']; @@ -1525,7 +1525,7 @@ class Probe private static function feed($url, $probe = true) { $ret = Network::curl($url); - if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { + if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) { return false; } $feed = $ret['body']; @@ -1598,7 +1598,7 @@ class Probe $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid)); - if (DBM::is_result($x) && DBM::is_result($r)) { + if (DBA::isResult($x) && DBA::isResult($r)) { $mailbox = Email::constructMailboxName($r[0]); $password = ''; openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']);