remove recommend block cache when necessary

This commit is contained in:
xiaomlove
2022-04-18 22:45:44 +08:00
parent 4b6850dba4
commit 204132746a
3 changed files with 12 additions and 2 deletions

View File

@@ -783,6 +783,7 @@ class TrackerRepository extends BaseRepository
if ($peer->exists) {
$update['prev_action'] = $peer->last_action;
$update['started'] = $peer->started;
if ($queries['event'] == 'completed') {
$update['finishedat'] = time();
}

View File

@@ -157,14 +157,16 @@ if(get_user_class()>=$torrentsticky_class && isset($_POST['sel_posstate']) && is
$pick_info = "";
$place_info = "";
if(get_user_class()>=$torrentmanage_class && $CURUSER['picker'] == 'yes')
if(get_user_class()>=$torrentmanage_class && ($CURUSER['picker'] == 'yes' || get_user_class() >= \App\Models\User::CLASS_SYSOP))
{
$doRecommend = false;
if(intval($_POST["sel_recmovie"] ?? 0) == 0)
{
if($row["picktype"] != 'normal')
$pick_info = ", recomendation canceled!";
$updateset[] = "picktype = 'normal'";
$updateset[] = "picktime = null";
$doRecommend = true;
}
elseif(intval($_POST["sel_recmovie"] ?? 0) == 1)
{
@@ -172,6 +174,7 @@ if(get_user_class()>=$torrentmanage_class && $CURUSER['picker'] == 'yes')
$pick_info = ", recommend as hot movie";
$updateset[] = "picktype = 'hot'";
$updateset[] = "picktime = ". sqlesc(date("Y-m-d H:i:s"));
$doRecommend = true;
}
elseif(intval($_POST["sel_recmovie"] ?? 0) == 2)
{
@@ -179,6 +182,7 @@ if(get_user_class()>=$torrentmanage_class && $CURUSER['picker'] == 'yes')
$pick_info = ", recommend as classic movie";
$updateset[] = "picktype = 'classic'";
$updateset[] = "picktime = ". sqlesc(date("Y-m-d H:i:s"));
$doRecommend = true;
}
elseif(intval($_POST["sel_recmovie"] ?? 0) == 3)
{
@@ -186,7 +190,12 @@ if(get_user_class()>=$torrentmanage_class && $CURUSER['picker'] == 'yes')
$pick_info = ", recommend as recommended movie";
$updateset[] = "picktype = 'recommended'";
$updateset[] = "picktime = ". sqlesc(date("Y-m-d H:i:s"));
$doRecommend = true;
}
if ($doRecommend) {
\Nexus\Database\NexusDB::cache_del("hot_resources");
\Nexus\Database\NexusDB::cache_del("classic_resources");
}
}

View File

@@ -211,7 +211,7 @@ if (get_user_class() >= $userprofile_class || $user["id"] == $CURUSER["id"])
tr_small($lang_userdetails['row_ip_address'], $user['ip'].$locationinfo, 1);
}
$res = sql_query("SELECT agent, peer_id, ip, port FROM peers WHERE userid = {$user['id']} GROUP BY agent") or sqlerr();
$res = sql_query("SELECT agent, peer_id, ip, port FROM peers WHERE userid = {$user['id']} GROUP BY agent,ip") or sqlerr();
$clientselect = "";
if (mysql_num_rows($res) > 0)
{