Update AppRegister controller, add scheduled cleanup task to delete older than 90d

pull/6108/head
Daniel Supernault 2025-08-08 05:39:39 -06:00
rodzic 3977137d02
commit c319dfbcc4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 23740873EE6F76A1
3 zmienionych plików z 34 dodań i 2 usunięć

Wyświetl plik

@ -0,0 +1,31 @@
<?php
namespace App\Console\Commands;
use App\Models\AppRegister;
use Illuminate\Console\Command;
class CleanupExpiredAppRegistrations extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:cleanup-expired-app-registrations';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
AppRegister::where('created_at', '<', now()->subDays(90))->delete();
}
}

Wyświetl plik

@ -32,6 +32,7 @@ class Kernel extends ConsoleKernel
$schedule->command('gc:passwordreset')->dailyAt('09:41')->onOneServer();
$schedule->command('gc:sessions')->twiceDaily(13, 23)->onOneServer();
$schedule->command('app:weekly-instance-scan')->weeklyOn(2, '4:20')->onOneServer();
$schedule->command('app:cleanup-expired-app-registrations')->dailyAt(1)->onOneServer();
if ((bool) config_cache('pixelfed.cloud_storage') && (bool) config_cache('media.delete_local_after_cloud')) {
$schedule->command('media:s3gc')->hourlyAt(15);

Wyświetl plik

@ -111,7 +111,7 @@ class AppRegisterController extends Controller
$exists = AppRegister::whereEmail($email)
->whereVerifyCode($code)
->where('created_at', '>', now()->subDays(220))
->where('created_at', '>', now()->subDays(90))
->exists();
return response()->json([
@ -219,7 +219,7 @@ class AppRegisterController extends Controller
$exists = AppRegister::whereEmail($email)
->whereVerifyCode($code)
->where('created_at', '>', now()->subDays(220))
->where('created_at', '>', now()->subDays(90))
->exists();
if (! $exists) {