inbox count cache etc.

This commit is contained in:
xiaomlove
2023-02-08 13:33:25 +08:00
parent e9c48e89b1
commit cf4a9207d8
14 changed files with 41 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-02-06');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-02-08');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -5776,7 +5776,7 @@ function list_require_search_box_id()
return $maps[nexus()->getScript()] ?? [];
}
function can_access_torrent($torrent)
function can_access_torrent($torrent, $uid)
{
global $specialcatmode;
if (get_setting('main.spsct') != 'yes') {
@@ -5797,7 +5797,7 @@ function can_access_torrent($torrent)
if ($searchBoxId != $specialcatmode) {
return true;
}
if (get_user_class() >= get_setting('authority.view_special_torrent')) {
if (user_can('view_special_torrent', false, $uid)) {
return true;
}
return false;

View File

@@ -1053,6 +1053,16 @@ function clear_icon_cache()
\Nexus\Database\NexusDB::cache_del("category_icon_content");
}
function clear_inbox_count_cache($uid)
{
do_log("clear_inbox_count_cache");
foreach (\Illuminate\Support\Arr::wrap($uid) as $id) {
\Nexus\Database\NexusDB::cache_del('user_'.$id.'_inbox_count');
\Nexus\Database\NexusDB::cache_del('user_'.$id.'_unread_message_count');
}
}
function user_can($permission, $fail = false, $uid = 0): bool
{
$log = "permission: $permission, fail: $fail, user: $uid";