diff --git a/app/Repositories/HitAndRunRepository.php b/app/Repositories/HitAndRunRepository.php index bcb6cac5..dadef83e 100644 --- a/app/Repositories/HitAndRunRepository.php +++ b/app/Repositories/HitAndRunRepository.php @@ -112,7 +112,7 @@ class HitAndRunRepository extends BaseRepository private function doCronjobUpdateStatus(array $setting, $uid = null, $torrentId = null, $ignoreTime = false) { - do_log("uid: $uid, torrentId: $torrentId, ignoreTime: " . var_export($ignoreTime, true)); + do_log("setting: " . json_encode($setting) . ", uid: $uid, torrentId: $torrentId, ignoreTime: " . var_export($ignoreTime, true)); $size = 1000; $page = 1; if (empty($setting['mode'])) { @@ -340,6 +340,7 @@ class HitAndRunRepository extends BaseRepository private function checkAndDisableUser(array $setting): void { + $logPrefix = "setting: " . json_encode($setting); $disableCounts = HitAndRun::getConfig('ban_user_when_counts_reach', $setting['search_box_id']); $query = HitAndRun::query() ->selectRaw("count(*) as counts, uid") @@ -354,13 +355,14 @@ class HitAndRunRepository extends BaseRepository } $result = $query->get(); if ($result->isEmpty()) { - do_log("No user to disable"); + do_log("$logPrefix, No user to disable: " . last_query()); return; } $users = User::query() ->with('language') ->where('enabled', User::ENABLED_YES) - ->find($result->pluck('id')->toArray(), ['id', 'username', 'lang']); + ->find($result->pluck('uid')->toArray(), ['id', 'username', 'lang']); + do_log("$logPrefix, Going to disable user: " . json_encode($users->toArray())); foreach ($users as $user) { $locale = $user->locale; $comment = nexus_trans('hr.unreached_disable_comment', [], $locale); @@ -370,7 +372,7 @@ class HitAndRunRepository extends BaseRepository 'added' => Carbon::now()->toDateTimeString(), 'subject' => $comment, 'msg' => nexus_trans('hr.unreached_disable_message_content', [ - 'ban_user_when_counts_reach' => Setting::get('hr.ban_user_when_counts_reach'), + 'ban_user_when_counts_reach' => $disableCounts, ], $locale), ]; Message::query()->insert($message); diff --git a/include/constants.php b/include/constants.php index a8d55c01..45063c5b 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@