Vote button and v2 file list topic url display (#1138)

This commit is contained in:
Cønstantine Kovalensky 2023-11-20 21:05:13 +04:00 committed by GitHub
commit 3dedb7e33d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 163 additions and 2 deletions

View file

@ -35,6 +35,19 @@ if ($delete_dlstat_sql = implode(') OR (', $delete_dlstat_sql)) {
DB()->query("DELETE QUICK FROM " . BB_BT_DLSTATUS . " WHERE ($delete_dlstat_sql)");
}
// Save the last 50 votes for topics
DB()->query('
DELETE t1
FROM' . BB_THX . ' t1
JOIN (
SELECT topic_id, MAX(time) as max_time
FROM ' . BB_THX . '
GROUP BY topic_id
HAVING COUNT(*) > 50
) t2
ON t1.topic_id = t2.topic_id AND t1.time = t2.max_time;
');
// Delete orphans
DB()->query("
DELETE QUICK dl