sforkowany z mirror/friendica
Added post update to remove duplicated contacts
rodzic
40a7d6eb42
commit
141bcf149d
|
@ -37,6 +37,9 @@ class PostUpdate
|
|||
if (!self::update1297()) {
|
||||
return false;
|
||||
}
|
||||
if (!self::update1322()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -414,6 +417,38 @@ class PostUpdate
|
|||
|
||||
Logger::info('Done');
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Set the delivery queue count to a negative value for all items preceding the feature.
|
||||
*
|
||||
* @return bool "true" when the job is done
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function update1322()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (Config::get('system', 'post_update_version') >= 1322) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Logger::info('Start');
|
||||
|
||||
$contacts = DBA::p("SELECT ANY_VALUE(`id`) AS `id` 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);
|
||||
|
||||
while ($contact = DBA::fetch($contacts)) {
|
||||
Logger::info('Remove duplicates', ['id' => $contact['id']]);
|
||||
Contact::handleDuplicateByID($contact['id']);
|
||||
}
|
||||
|
||||
DBA::close($contact);
|
||||
Config::set('system', 'post_update_version', 1322);
|
||||
|
||||
Logger::info('Done');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue