X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FPullDirectory.php;h=d174d11f3e5d36a67b898f5d2883667b3f9dff73;hb=b227d65dfc086c4d61e471360c09a34abf21a301;hp=d9a559bf5f260255f5a68958a9640baba242ea85;hpb=054c301ef0345c4ff9f35cfd08717757eab17b9d;p=friendica.git diff --git a/src/Worker/PullDirectory.php b/src/Worker/PullDirectory.php index d9a559bf5f..d174d11f3e 100644 --- a/src/Worker/PullDirectory.php +++ b/src/Worker/PullDirectory.php @@ -1,6 +1,6 @@ get('system', 'directory'); + $directory = Search::getGlobalDirectory(); if (empty($directory)) { Logger::info('No directory configured'); return; } - $now = (int)DI::config()->get('system', 'last-directory-sync', 0); + $now = (int)(DI::keyValue()->get('last-directory-sync') ?? 0); Logger::info('Synchronization started.', ['now' => $now, 'directory' => $directory]); - $result = DI::httpRequest()->fetch($directory . '/sync/pull/since/' . $now); + $result = DI::httpClient()->fetch($directory . '/sync/pull/since/' . $now, HttpClientAccept::JSON); if (empty($result)) { Logger::info('Directory server return empty result.', ['directory' => $directory]); return; @@ -62,7 +64,7 @@ class PullDirectory $result = Contact::addByUrls($contacts['results']); $now = $contacts['now'] ?? 0; - DI::config()->set('system', 'last-directory-sync', $now); + DI::keyValue()->set('last-directory-sync', $now); Logger::info('Synchronization ended', ['now' => $now, 'count' => $result['count'], 'added' => $result['added'], 'updated' => $result['updated'], 'unchanged' => $result['unchanged'], 'directory' => $directory]); }