mirror of
https://github.com/friendica/friendica
synced 2025-05-03 23:44:10 +02:00
Fixes several database errors, removes "relation" handling
This commit is contained in:
parent
de90f5351f
commit
99a145f7cf
11 changed files with 39 additions and 176 deletions
|
@ -137,14 +137,16 @@ class Relation
|
|||
$actor = Contact::getIdForURL($contact);
|
||||
if (!empty($actor)) {
|
||||
if (in_array($contact, $followers)) {
|
||||
$fields = ['cid' => $target, 'relation-cid' => $actor, 'follows' => true, 'follow-updated' => DateTimeFormat::utcNow()];
|
||||
DBA::insert('contact-relation', $fields, Database::INSERT_UPDATE);
|
||||
$condition = ['cid' => $target, 'relation-cid' => $actor];
|
||||
DBA::insert('contact-relation', $condition, Database::INSERT_IGNORE);
|
||||
DBA::update('contact-relation', ['follows' => true, 'follow-updated' => DateTimeFormat::utcNow()], $condition);
|
||||
$follower_counter++;
|
||||
}
|
||||
|
||||
if (in_array($contact, $followings)) {
|
||||
$fields = ['cid' => $actor, 'relation-cid' => $target, 'follows' => true, 'follow-updated' => DateTimeFormat::utcNow()];
|
||||
DBA::insert('contact-relation', $fields, Database::INSERT_UPDATE);
|
||||
$condition = ['cid' => $actor, 'relation-cid' => $target];
|
||||
DBA::insert('contact-relation', $condition, Database::INSERT_IGNORE);
|
||||
DBA::update('contact-relation', ['follows' => true, 'follow-updated' => DateTimeFormat::utcNow()], $condition);
|
||||
$following_counter++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ class Event
|
|||
return;
|
||||
}
|
||||
|
||||
DBA::delete('event', ['id' => $event_id], ['cascade' => false]);
|
||||
DBA::delete('event', ['id' => $event_id]);
|
||||
Logger::log("Deleted event ".$event_id, Logger::DEBUG);
|
||||
}
|
||||
|
||||
|
|
|
@ -318,14 +318,6 @@ class Item
|
|||
|
||||
Post\DeliveryData::delete($item['uri-id']);
|
||||
|
||||
// When the permission set will be used in photo and events as well,
|
||||
// this query here needs to be extended.
|
||||
// @todo Currently deactivated. We need the permission set in the deletion process.
|
||||
// This is a reminder to add the removal somewhere else.
|
||||
//if (!empty($item['psid']) && !self::exists(['psid' => $item['psid'], 'deleted' => false])) {
|
||||
// DBA::delete('permissionset', ['id' => $item['psid']], ['cascade' => false]);
|
||||
//}
|
||||
|
||||
// If it's the parent of a comment thread, kill all the kids
|
||||
if ($item['gravity'] == GRAVITY_PARENT) {
|
||||
self::markForDeletion(['parent' => $item['parent'], 'deleted' => false], $priority);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue