mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-22 10:57:27 +08:00
improve hr + agent update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.9.7');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-07-18');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-07-21');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -5935,11 +5935,14 @@ function build_medal_image(\Illuminate\Support\Collection $medals, $maxHeight =
|
||||
function insert_torrent_tags($torrentId, $tagIdArr, $sync = false)
|
||||
{
|
||||
$specialTags = \App\Models\Tag::listSpecial();
|
||||
$canSetSpecialTag = user_can('torrent-set-special-tag');
|
||||
$canSetSpecialTag = \App\Auth\Permission::canSetTorrentSpecialTag();
|
||||
$dateTimeStringNow = date('Y-m-d H:i:s');
|
||||
if ($sync) {
|
||||
\App\Models\TorrentTag::query()->where("torrent_id", $torrentId)->delete();
|
||||
// sql_query("delete from torrent_tags where torrent_id = $torrentId");
|
||||
$delQuery = \App\Models\TorrentTag::query()->where("torrent_id", $torrentId);
|
||||
if (!$canSetSpecialTag) {
|
||||
$delQuery->whereNotIn("tag_id", $specialTags);
|
||||
}
|
||||
$delQuery->delete();
|
||||
}
|
||||
if (empty($tagIdArr)) {
|
||||
return;
|
||||
@@ -5956,7 +5959,6 @@ function insert_torrent_tags($torrentId, $tagIdArr, $sync = false)
|
||||
$insertTagsSql .= implode(', ', $values);
|
||||
do_log("[INSERT_TAGS], torrent: $torrentId with tags: " . nexus_json_encode($tagIdArr));
|
||||
\Nexus\Database\NexusDB::statement($insertTagsSql);
|
||||
// sql_query($insertTagsSql);
|
||||
}
|
||||
|
||||
function get_smile($num)
|
||||
|
||||
@@ -1208,6 +1208,19 @@ function clear_agent_allow_deny_cache()
|
||||
\Nexus\Database\NexusDB::cache_del($denyCacheKey . $suffix);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see announce.php
|
||||
* @param $infoHash
|
||||
* @return void
|
||||
*/
|
||||
function clear_torrent_cache($infoHash)
|
||||
{
|
||||
do_log("clear_torrent_cache");
|
||||
\Nexus\Database\NexusDB::cache_del('torrent_hash_'.$infoHash.'_content');
|
||||
\Nexus\Database\NexusDB::cache_del("torrent_not_exists:$infoHash");
|
||||
}
|
||||
|
||||
function user_can($permission, $fail = false, $uid = 0): bool
|
||||
{
|
||||
$log = "permission: $permission, fail: $fail, user: $uid";
|
||||
@@ -1338,6 +1351,7 @@ function is_danger_url($url): bool
|
||||
return false;
|
||||
}
|
||||
|
||||
//here must retrieve the real time info, no cache!!!
|
||||
function get_snatch_info($torrentId, $userId)
|
||||
{
|
||||
return mysql_fetch_assoc(sql_query(sprintf('select * from snatched where torrentid = %s and userid = %s order by id desc limit 1', $torrentId, $userId)));
|
||||
|
||||
Reference in New Issue
Block a user