From ef2c6b42cdcd5b0a45630729a04aec6957000776 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Tue, 29 Jul 2025 19:03:13 +0300 Subject: [PATCH] Update thanks.php --- library/ajax/thanks.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/library/ajax/thanks.php b/library/ajax/thanks.php index 95b132386..36a82c985 100644 --- a/library/ajax/thanks.php +++ b/library/ajax/thanks.php @@ -64,9 +64,15 @@ switch ($mode) { $this->ajax_die($lang['NEED_TO_LOGIN_FIRST']); } + if (!$cached_thanks = CACHE('bb_cache')->get($thanks_cache_key)) { + $cached_thanks = DB()->fetch_rowset('SELECT u.username, u.user_rank, u.user_id, t.* FROM ' . BB_THX . ' t, ' . BB_USERS . " u WHERE t.topic_id = $topic_id AND t.user_id = u.user_id"); + if (!empty($cached_thanks)) { + CACHE('bb_cache')->set($thanks_cache_key, $cached_thanks, $cache_lifetime); + } + } + $user_list = []; - $sql = DB()->fetch_rowset('SELECT u.username, u.user_rank, u.user_id, t.* FROM ' . BB_THX . ' t, ' . BB_USERS . " u WHERE t.topic_id = $topic_id AND t.user_id = u.user_id"); - foreach ($sql as $row) { + foreach ($cached_thanks as $row) { $user_list[] = '' . profile_url($row) . ' (' . bb_date($row['time']) . ')'; }