mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
isIPSeedBox call SeedBoxRepository::isSeedBoxFromUserRecords
This commit is contained in:
@@ -915,17 +915,11 @@ function isIPSeedBoxFromASN($ip, $exceptionWhenYes = false): bool
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function isIPSeedBox($ip, $uid): bool
|
||||||
* @deprecated
|
|
||||||
* @param $ip
|
|
||||||
* @param $uid
|
|
||||||
* @param $withoutCache
|
|
||||||
* @param $exceptionWhenYes
|
|
||||||
* @return bool
|
|
||||||
* @throws \App\Exceptions\SeedBoxYesException
|
|
||||||
*/
|
|
||||||
function isIPSeedBox($ip, $uid, $withoutCache = false, $exceptionWhenYes = false): bool
|
|
||||||
{
|
{
|
||||||
|
return \App\Repositories\SeedBoxRepository::isSeedBoxFromUserRecords($uid, $ip)['result'];
|
||||||
|
|
||||||
|
/*
|
||||||
$key = "nexus_is_ip_seed_box:ip:$ip:uid:$uid";
|
$key = "nexus_is_ip_seed_box:ip:$ip:uid:$uid";
|
||||||
$cacheData = \Nexus\Database\NexusDB::cache_get($key);
|
$cacheData = \Nexus\Database\NexusDB::cache_get($key);
|
||||||
if (in_array($cacheData, [0, 1, '0', '1'], true) && !$withoutCache) {
|
if (in_array($cacheData, [0, 1, '0', '1'], true) && !$withoutCache) {
|
||||||
@@ -985,6 +979,7 @@ function isIPSeedBox($ip, $uid, $withoutCache = false, $exceptionWhenYes = false
|
|||||||
\Nexus\Database\NexusDB::cache_put($key, 0, 300);
|
\Nexus\Database\NexusDB::cache_put($key, 0, 300);
|
||||||
do_log("$key, no result, false");
|
do_log("$key, no result, false");
|
||||||
return false;
|
return false;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDataTraffic(array $torrent, array $queries, array $user, $peer, $snatch, $promotionInfo)
|
function getDataTraffic(array $torrent, array $queries, array $user, $peer, $snatch, $promotionInfo)
|
||||||
|
|||||||
@@ -337,10 +337,10 @@ $isSeedBoxRuleEnabled = get_setting('seed_box.enabled') == 'yes';
|
|||||||
$isIPSeedBox = false;
|
$isIPSeedBox = false;
|
||||||
if ($isSeedBoxRuleEnabled) {
|
if ($isSeedBoxRuleEnabled) {
|
||||||
if (!empty($ipv4)) {
|
if (!empty($ipv4)) {
|
||||||
$isIPSeedBox = \App\Repositories\SeedBoxRepository::isSeedBoxFromUserRecords($userid, $ipv4)['result'];
|
$isIPSeedBox = isIPSeedBox($ipv4, $userid);
|
||||||
}
|
}
|
||||||
if (!$isIPSeedBox && !empty($ipv6)) {
|
if (!$isIPSeedBox && !empty($ipv6)) {
|
||||||
$isIPSeedBox = \App\Repositories\SeedBoxRepository::isSeedBoxFromUserRecords($userid, $ipv6)['result'];
|
$isIPSeedBox = isIPSeedBox($ipv6, $userid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$log .= ", [SEED_BOX], isSeedBoxRuleEnabled: $isSeedBoxRuleEnabled, isIPSeedBox: $isIPSeedBox";
|
$log .= ", [SEED_BOX], isSeedBoxRuleEnabled: $isSeedBoxRuleEnabled, isIPSeedBox: $isIPSeedBox";
|
||||||
|
|||||||
Reference in New Issue
Block a user