fear(vote topic): Improved functionality & implemented caching

This commit is contained in:
Roman Kelesidis 2025-07-29 18:29:58 +03:00
commit 506c428fde
No known key found for this signature in database
GPG key ID: D8157C4D4C4C6DB4
2 changed files with 8 additions and 5 deletions

View file

@ -48,10 +48,13 @@ switch ($mode) {
DB()->query('INSERT IGNORE INTO ' . BB_THX . " ($columns) VALUES ($values)");
// Limit voters per topic
$tor_thank_limit_per_topic = (int)$bb_cfg['tor_thank_limit_per_topic'];
if ($tor_thank_limit_per_topic > 0) {
$thanks_count = DB()->fetch_row('SELECT COUNT(*) as thx FROM ' . BB_THX . " WHERE topic_id = $topic_id")['thx'];
if ($thanks_count > (int)$bb_cfg['tor_thank_limit_per_topic']) {
if ($thanks_count > $tor_thank_limit_per_topic) {
DB()->query('DELETE FROM ' . BB_THX . " WHERE topic_id = $topic_id ORDER BY time ASC LIMIT 1");
}
}
break;
case 'get':
if (IS_GUEST && !$bb_cfg['tor_thanks_list_guests']) {

View file

@ -593,7 +593,7 @@ $bb_cfg['user_not_active_days_keep'] = 180; // After how many days should I dele
// Vote for torrents
$bb_cfg['tor_thank'] = true;
$bb_cfg['tor_thanks_list_guests'] = true; // Show voters to guests
$bb_cfg['tor_thank_limit_per_topic'] = 50;
$bb_cfg['tor_thank_limit_per_topic'] = 50; // Set "0" to disable limit
// Groups
$bb_cfg['group_members_per_page'] = 50; // How many groups will be displayed in a page