1
0
Fork 0

"id" is now post-user-id

This commit is contained in:
Michael 2021-02-14 18:33:15 +00:00
commit 36357e790e
9 changed files with 76 additions and 63 deletions

View file

@ -55,9 +55,10 @@ class APDelivery
}
if (empty($uri_id) && !empty($item_id)) {
$item = Post::selectFirst(['uri-id'], ['id' => $item_id]);
$item = Post::selectFirst(['uri-id', 'id'], ['item-id' => $item_id]);
if (!empty($item['uri-id'])) {
$uri_id = $item['uri-id'];
$item_id = $item['id'];
}
} elseif (!empty($uri_id) && !empty($item_id)) {
$item = Post::selectFirst(['id'], ['uri-id' => $uri_id, 'uid' => $uid]);

View file

@ -62,6 +62,13 @@ class Delivery
return;
}
$target_id = $post['id'];
} elseif (!in_array($cmd, [Delivery::MAIL, Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) {
$post = Post::selectFirst(['id', 'uid', 'uri-id'], ['item-id' => $post_uriid]);
if (DBA::isResult($post)) {
$target_id = $post['id'];
$sender_uid = $post['uid'];
$post_uriid = $post['uri-id'];
}
} else {
$target_id = $post_uriid;
}

View file

@ -44,10 +44,10 @@ class Expire
Logger::log('Delete expired items', Logger::DEBUG);
// physically remove anything that has been deleted for more than two months
$condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"];
$rows = Post::select(['id', 'guid', 'uri-id', 'uid'], $condition);
$rows = Post::select(['item-id', 'guid', 'uri-id', 'uid'], $condition);
while ($row = Post::fetch($rows)) {
Logger::info('Delete expired item', ['id' => $row['id'], 'guid' => $row['guid']]);
DBA::delete('item', ['id' => $row['id']]);
Logger::info('Delete expired item', ['id' => $row['item-id'], 'guid' => $row['guid']]);
DBA::delete('item', ['id' => $row['item-id']]);
Post\User::delete(['uri-id' => $row['uri-id'], 'uid' => $row['uid']]);
Post\ThreadUser::delete(['uri-id' => $row['uri-id'], 'uid' => $row['uid']]);
}

View file

@ -66,6 +66,14 @@ class Notifier
return;
}
$target_id = $post['id'];
} elseif (!in_array($cmd, [Delivery::MAIL, Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) {
$post = Post::selectFirst(['id'], ['item-id' => $post_uriid]);
$post = Post::selectFirst(['id', 'uid', 'uri-id'], ['item-id' => $post_uriid]);
if (DBA::isResult($post)) {
$target_id = $post['id'];
$sender_uid = $post['uid'];
$post_uriid = $post['uri-id'];
}
} else {
$target_id = $post_uriid;
}

View file

@ -47,10 +47,10 @@ class RemoveContact {
$condition = ['uid' => $contact['uid'], 'contact-id' => $id];
}
do {
$items = Post::select(['id', 'post-user-id', 'uri-id', 'guid'], $condition, ['limit' => 100]);
$items = Post::select(['item-id', 'post-user-id', 'uri-id', 'guid'], $condition, ['limit' => 100]);
while ($item = Post::fetch($items)) {
Logger::info('Delete removed contact item', ['id' => $item['id'], 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
DBA::delete('item', ['id' => $item['id']]);
Logger::info('Delete removed contact item', ['id' => $item['item-id'], 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
DBA::delete('item', ['id' => $item['item-id']]);
Post::delete(['uri-id' => $item['uri-id']]);
Post\ThreadUser::delete(['post-user-id' => $item['post-user-id']]);
Post\Thread::delete(['uri-id' => $item['uri-id']]);