- private static function pollContacts($parameter, $generation) {
- $manual_id = 0;
- $generation = 0;
- $force = false;
- $restart = false;
-
- if ($parameter == 'force') {
- $force = true;
- }
- if ($parameter == 'restart') {
- $restart = true;
- $generation = intval($generation);
- if (!$generation) {
- killme();
+ private static function updatePublicContacts() {
+ $count = 0;
+ $last_updated = DateTimeFormat::utc('now - 1 week');
+ $condition = ["`network` IN (?, ?, ?, ?) AND `uid` = ? AND NOT `self` AND `last-update` < ?",
+ Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, 0, $last_updated];
+
+ $total = DBA::count('contact', $condition);
+ $oldest_date = '';
+ $oldest_id = '';
+ $contacts = DBA::select('contact', ['id', 'last-update'], $condition, ['limit' => 100, 'order' => ['last-update']]);
+ while ($contact = DBA::fetch($contacts)) {
+ if (empty($oldest_id)) {
+ $oldest_id = $contact['id'];
+ $oldest_date = $contact['last-update'];