mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
Make caching for ban list (#1269)
This commit is contained in:
parent
ed34bbb735
commit
66083cabad
7 changed files with 46 additions and 31 deletions
|
@ -2183,15 +2183,13 @@ function user_birthday_icon($user_birthday, $user_id): string
|
|||
*/
|
||||
function getUserBanInfo(int $userId): ?array
|
||||
{
|
||||
return DB()->fetch_row("SELECT * FROM " . BB_BANLIST . " WHERE ban_userid = $userId LIMIT 1");
|
||||
}
|
||||
global $datastore;
|
||||
|
||||
/**
|
||||
* Returns information about all bans
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
function getAllBans(): ?array
|
||||
{
|
||||
return DB()->fetch_rowset("SELECT * FROM " . BB_BANLIST);
|
||||
// Get bans info from datastore
|
||||
if (!$bans = $datastore->get('ban_list')) {
|
||||
$datastore->update('ban_list');
|
||||
$bans = $datastore->get('ban_list');
|
||||
}
|
||||
|
||||
return $bans[$userId] ?? [];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue