]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/PullDirectory.php
Merge pull request #9397 from vinzv/9238-red-color-unread-messages-faded
[friendica.git] / src / Worker / PullDirectory.php
index a83b0a13be383e7615c03e17a522054c78c5f749..8592105b24b998388c3f002e76f77635e80c0b36 100644 (file)
@@ -22,7 +22,6 @@
 namespace Friendica\Worker;
 
 use Friendica\Core\Logger;
-use Friendica\Core\Worker;
 use Friendica\DI;
 use Friendica\Model\Contact;
 
@@ -60,22 +59,11 @@ class PullDirectory
                        return;
                }
 
+               $result = Contact::addByUrls($contacts['results']);
+
                $now = $contacts['now'] ?? 0;
-               $count = $contacts['count'] ?? 0;
-               $added = 0;
-               $updated = 0;
-               foreach ($contacts['results'] as $url) {
-                       $contact = Contact::getByURL($url, false, ['id']); 
-                       if (empty($contact['id'])) {
-                               Worker::add(PRIORITY_LOW, 'AddContact', 0, $url);
-                               ++$added;
-                       } else {
-                               Worker::add(PRIORITY_LOW, "UpdateContact", $contact['id']);
-                               ++$updated;
-                       }
-               }
                DI::config()->set('system', 'last-directory-sync', $now);
 
-               Logger::info('Synchronization ended.', ['now' => $now, 'count' => $count, 'added' => $added, 'updated' => $updated, 'directory' => $directory]);
+               Logger::info('Synchronization ended', ['now' => $now, 'count' => $result['count'], 'added' => $result['added'], 'updated' => $result['updated'], 'unchanged' => $result['unchanged'], 'directory' => $directory]);
        }
 }