mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 00:01:21 +00:00
Update inactive users deletion handling
This commit is contained in:
@@ -195,6 +195,7 @@ HORIZON_PREFIX=horizon:
|
||||
POSTMARK_TOKEN=
|
||||
|
||||
PURGE_INACTIVE_USERS=false
|
||||
PURGE_INACTIVE_USERS_DAYS=180
|
||||
|
||||
OTP_ENABLED=false
|
||||
|
||||
|
||||
@@ -28,7 +28,16 @@ class RemoveInactiveAccounts implements ShouldQueue
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
User::query()->where('lastlogin', '<', now()->subMonths(6))->where('apiaccess', '<', now()->subMonths(6))->where('roles_id', '=', 1)->delete();
|
||||
User::query()->where('lastlogin', '<', now()->subMonths(6))->whereNull('apiaccess')->where('roles_id', '=', 1)->delete();
|
||||
$purgeDays = config('nntmux.purge_inactive_users_days');
|
||||
User::query()->where('roles_id', '=', 1)
|
||||
->where(function ($query) use ($purgeDays) {
|
||||
$query->where('lastlogin', '<', now()->subDays($purgeDays))
|
||||
->orWhereNull('lastlogin');
|
||||
})
|
||||
->where(function ($query) use ($purgeDays) {
|
||||
$query->where('apiaccess', '<', now()->subDays($purgeDays))
|
||||
->orWhereNull('apiaccess');
|
||||
})
|
||||
->delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ return [
|
||||
'admin_email' => env('ADMIN_EMAIL', 'admin@example.com'),
|
||||
'multiprocessing_max_child_time' => env('NN_MULTIPROCESSING_MAX_CHILD_TIME', 1800),
|
||||
'purge_inactive_users' => env('PURGE_INACTIVE_USERS', false),
|
||||
'purge_inactive_users_days' => env('PURGE_INACTIVE_USERS_DAYS', 180),
|
||||
'elasticsearch_enabled' => env('ELASTICSEARCH_ENABLED', false),
|
||||
'btcpay_webhook_secret' => env('BTCPAY_SECRET'),
|
||||
'tmp_unrar_path' => env('TEMP_UNRAR_PATH', storage_path('tmp/unrar/')),
|
||||
|
||||
Reference in New Issue
Block a user