X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FSearchDirectory.php;h=546c369b2c5569952deaed0a663e3f5aa281a789;hb=76ae210527487bea129411e8ed02ac4997d0d89b;hp=c099a5e28a3dad0f0b1b1e6057a5f86d9521ec6f;hpb=0e05ff68686270d87447c570e28543a5bcc7e755;p=friendica.git diff --git a/src/Worker/SearchDirectory.php b/src/Worker/SearchDirectory.php index c099a5e28a..546c369b2c 100644 --- a/src/Worker/SearchDirectory.php +++ b/src/Worker/SearchDirectory.php @@ -27,10 +27,9 @@ use Friendica\Core\Protocol; use Friendica\Core\Search; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\GServer; -use Friendica\Network\Probe; -use Friendica\Util\Network; use Friendica\Util\Strings; class SearchDirectory @@ -52,18 +51,17 @@ class SearchDirectory } } - $x = Network::fetchUrl(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search)); + $x = DI::httpRequest()->fetch(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search)); $j = json_decode($x); if (!empty($j->results)) { foreach ($j->results as $jj) { // Check if the contact already exists - $gcontact = DBA::selectFirst('gcontact', ['id', 'last_contact', 'last_failure', 'updated'], ['nurl' => Strings::normaliseLink($jj->url)]); + $gcontact = DBA::selectFirst('gcontact', ['failed'], ['nurl' => Strings::normaliseLink($jj->url)]); if (DBA::isResult($gcontact)) { Logger::info('Profile already exists', ['profile' => $jj->url, 'search' => $search]); - if (($gcontact['last_contact'] < $gcontact['last_failure']) && - ($gcontact['updated'] < $gcontact['last_failure'])) { + if ($gcontact['failed']) { continue; } @@ -81,7 +79,7 @@ class SearchDirectory Logger::info('Friendica server seems to be okay.', ['server' => $server_url]); } - $data = Probe::uri($jj->url); + $data = Contact::getByURL($jj->url); if ($data['network'] == Protocol::DFRN) { Logger::info('Add profile to local directory', ['profile' => $jj->url]);