mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
cache rss user content
This commit is contained in:
@@ -1136,6 +1136,7 @@ function clear_user_cache($uid, $passkey = '')
|
|||||||
\Nexus\Database\NexusDB::cache_del("direct_permissions:$uid");
|
\Nexus\Database\NexusDB::cache_del("direct_permissions:$uid");
|
||||||
if ($passkey) {
|
if ($passkey) {
|
||||||
\Nexus\Database\NexusDB::cache_del('user_passkey_'.$passkey.'_content');//announce.php
|
\Nexus\Database\NexusDB::cache_del('user_passkey_'.$passkey.'_content');//announce.php
|
||||||
|
\Nexus\Database\NexusDB::cache_del('user_passkey_'.$passkey.'_rss');//torrentrss.php
|
||||||
}
|
}
|
||||||
$userInfo = \App\Models\User::query()->find($uid, \App\Models\User::$commonFields);
|
$userInfo = \App\Models\User::query()->find($uid, \App\Models\User::$commonFields);
|
||||||
if ($userInfo) {
|
if ($userInfo) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ if ($cacheData && nexus_env('APP_ENV') != 'local') {
|
|||||||
header ("Content-type: text/xml");
|
header ("Content-type: text/xml");
|
||||||
die($cacheData);
|
die($cacheData);
|
||||||
}
|
}
|
||||||
dbconn();
|
dbconn(doLogin: false);
|
||||||
function hex_esc($matches) {
|
function hex_esc($matches) {
|
||||||
return sprintf("%02x", ord($matches[0]));
|
return sprintf("%02x", ord($matches[0]));
|
||||||
}
|
}
|
||||||
@@ -19,8 +19,10 @@ $dllink = false;
|
|||||||
|
|
||||||
$where = "";
|
$where = "";
|
||||||
if ($passkey){
|
if ($passkey){
|
||||||
$res = sql_query("SELECT id, enabled, parked, passkey FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
$user = \Nexus\Database\NexusDB::remember('user_passkey_'.$passkey.'_rss', 3600, function () use ($passkey) {
|
||||||
$user = mysql_fetch_array($res);
|
$res = sql_query("SELECT id, enabled, parked, passkey FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
||||||
|
return mysql_fetch_array($res);
|
||||||
|
});
|
||||||
if (!$user)
|
if (!$user)
|
||||||
die("invalid passkey");
|
die("invalid passkey");
|
||||||
elseif ($user['enabled'] == 'no' || $user['parked'] == 'yes')
|
elseif ($user['enabled'] == 'no' || $user['parked'] == 'yes')
|
||||||
|
|||||||
Reference in New Issue
Block a user