return true;
}
/**
- * Set the delivery queue count to a negative value for all items preceding the feature.
+ * Remove contact duplicates
*
* @return bool "true" when the job is done
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
Logger::info('Start');
- $contacts = DBA::p("SELECT ANY_VALUE(`id`) AS `id` FROM `contact`
+ $contacts = DBA::p("SELECT `nurl`, `uid` FROM `contact`
WHERE EXISTS (SELECT `nurl` FROM `contact` AS `c2`
- WHERE `c2`.`nurl` = `contact`.`nurl` AND `c2`.`id` != `contact`.`id` AND `c2`.`uid` = `contact`.`uid` AND `c2`.`network` = `contact`.`network`)
- AND `network` IN (?, ?, ?) GROUP BY `nurl`", Protocol::DIASPORA, Protocol::OSTATUS, Protocol::ACTIVITYPUB);
+ WHERE `c2`.`nurl` = `contact`.`nurl` AND `c2`.`id` != `contact`.`id` AND `c2`.`uid` = `contact`.`uid` AND `c2`.`network` IN (?, ?, ?) AND NOT `deleted`)
+ AND (`network` IN (?, ?, ?) OR (`uid` = ?)) AND NOT `deleted` GROUP BY `nurl`, `uid`",
+ Protocol::DIASPORA, Protocol::OSTATUS, Protocol::ACTIVITYPUB,
+ Protocol::DIASPORA, Protocol::OSTATUS, Protocol::ACTIVITYPUB, 0);
while ($contact = DBA::fetch($contacts)) {
- Logger::info('Remove duplicates', ['id' => $contact['id']]);
- Contact::handleDuplicateByID($contact['id']);
+ Logger::info('Remove duplicates', ['nurl' => $contact['nurl'], 'uid' => $contact['uid']]);
+ Contact::removeDuplicates($contact['nurl'], $contact['uid']);
}
DBA::close($contact);