From 2a9b9ce919925a8d719e854d96c660d716de4bb9 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Wed, 8 Jun 2022 16:21:29 +0800 Subject: [PATCH] api announce apply_filter --- app/Repositories/TrackerRepository.php | 6 +++--- public/takeedit.php | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Repositories/TrackerRepository.php b/app/Repositories/TrackerRepository.php index e7445415..b1b5facb 100644 --- a/app/Repositories/TrackerRepository.php +++ b/app/Repositories/TrackerRepository.php @@ -148,7 +148,7 @@ class TrackerRepository extends BaseRepository $repDict = $this->generateFailedAnnounceResponse($exception->getMessage()); } catch (\Throwable $exception) { //other system exception - do_log("[" . get_class($exception) . "] " . $exception->getMessage() . "\n" . $exception->getTraceAsString(), 'error'); + do_log("[" . get_class($exception) . "] " . $exception->getMessage() . $exception->getTraceAsString(), 'error'); $repDict = $this->generateFailedAnnounceResponse("system error, report to sysop please, hint: " . nexus()->getRequestId()); } finally { if (isset($user)) { @@ -385,7 +385,7 @@ class TrackerRepository extends BaseRepository if ($torrent->banned == 'yes' && $user->class < Setting::get('authority.seebanned')) { throw new TrackerException("torrent banned"); } - return array_filter('torrent_detail', $torrent); + return apply_filter('torrent_detail', $torrent); } protected function checkPeer(Torrent $torrent, array $queries, User $user): void @@ -1003,7 +1003,7 @@ class TrackerRepository extends BaseRepository $repDict = $this->generateFailedAnnounceResponse($exception->getMessage()); } catch (\Throwable $exception) { //other system exception - do_log("[" . get_class($exception) . "] " . $exception->getMessage() . "\n" . $exception->getTraceAsString(), 'error'); + do_log("[" . get_class($exception) . "] " . $exception->getMessage() . $exception->getTraceAsString(), 'error'); $repDict = $this->generateFailedAnnounceResponse("system error, report to sysop please, hint: " . nexus()->getRequestId()); } finally { if (isset($user)) { diff --git a/public/takeedit.php b/public/takeedit.php index f6503d91..c9c380d1 100644 --- a/public/takeedit.php +++ b/public/takeedit.php @@ -194,8 +194,10 @@ if(get_user_class()>=$torrentmanage_class && ($CURUSER['picker'] == 'yes' || get } if ($doRecommend) { do_log("[DEL_HOT_CLASSIC_RESOURCES]"); - \Nexus\Database\NexusDB::cache_del("hot_resources"); - \Nexus\Database\NexusDB::cache_del("classic_resources"); + foreach ([$browsecatmode, $specialcatmode] as $mode) { + \Nexus\Database\NexusDB::cache_del("hot_{$mode}_resources"); + \Nexus\Database\NexusDB::cache_del("classic_{$mode}_resources"); + } } }