Show the last seeder's username in topics (#1051)

This commit is contained in:
Cønstantine Kovalensky 2023-11-07 14:37:13 +04:00 committed by GitHub
commit d7ce42f6be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 11 deletions

View file

@ -54,13 +54,14 @@ if ($bb_cfg['tracker']['update_dlstat']) {
// Update last seeder info in BUF
DB()->query("
REPLACE INTO " . BUF_LAST_SEEDER . "
(topic_id, seeder_last_seen)
SELECT
topic_id, " . TIMENOW . "
FROM " . BB_BT_TRACKER . "
WHERE seeder = 1
GROUP BY topic_id
REPLACE INTO " . BUF_LAST_SEEDER . "
(topic_id, user_id, seeder_last_seen)
SELECT
topic_id, user_id, " . TIMENOW . "
FROM " . BB_BT_TRACKER . "
WHERE seeder = 1
GROUP BY topic_id, user_id
ORDER BY update_time DESC
");
// Clean peers table

View file

@ -16,7 +16,8 @@ DB()->query("
" . BUF_LAST_SEEDER . " b,
" . BB_BT_TORRENTS . " tor
SET
tor.seeder_last_seen = b.seeder_last_seen
tor.seeder_last_seen = b.seeder_last_seen,
tor.last_seeder_id = b.user_id
WHERE
tor.topic_id = b.topic_id
");