kopia lustrzana https://github.com/pixelfed/pixelfed
Update AppRegister controller, add scheduled cleanup task to delete older than 90d
rodzic
3977137d02
commit
c319dfbcc4
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,6 +32,7 @@ class Kernel extends ConsoleKernel
|
||||||
$schedule->command('gc:passwordreset')->dailyAt('09:41')->onOneServer();
|
$schedule->command('gc:passwordreset')->dailyAt('09:41')->onOneServer();
|
||||||
$schedule->command('gc:sessions')->twiceDaily(13, 23)->onOneServer();
|
$schedule->command('gc:sessions')->twiceDaily(13, 23)->onOneServer();
|
||||||
$schedule->command('app:weekly-instance-scan')->weeklyOn(2, '4:20')->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')) {
|
if ((bool) config_cache('pixelfed.cloud_storage') && (bool) config_cache('media.delete_local_after_cloud')) {
|
||||||
$schedule->command('media:s3gc')->hourlyAt(15);
|
$schedule->command('media:s3gc')->hourlyAt(15);
|
||||||
|
|
|
@ -111,7 +111,7 @@ class AppRegisterController extends Controller
|
||||||
|
|
||||||
$exists = AppRegister::whereEmail($email)
|
$exists = AppRegister::whereEmail($email)
|
||||||
->whereVerifyCode($code)
|
->whereVerifyCode($code)
|
||||||
->where('created_at', '>', now()->subDays(220))
|
->where('created_at', '>', now()->subDays(90))
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
@ -219,7 +219,7 @@ class AppRegisterController extends Controller
|
||||||
|
|
||||||
$exists = AppRegister::whereEmail($email)
|
$exists = AppRegister::whereEmail($email)
|
||||||
->whereVerifyCode($code)
|
->whereVerifyCode($code)
|
||||||
->where('created_at', '>', now()->subDays(220))
|
->where('created_at', '>', now()->subDays(90))
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if (! $exists) {
|
if (! $exists) {
|
||||||
|
|
Ładowanie…
Reference in New Issue