Update console kernel

This commit is contained in:
Daniel Supernault 2021-01-17 01:47:02 -07:00
parent 21837be99f
commit e71e525ac9
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 2 additions and 65 deletions

View file

@ -1,60 +0,0 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Profile;
use App\User;
class FixSoftDeletedProfile extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'fix:sdprofile';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$profiles = Profile::whereNull('domain')
->withTrashed()
->where('deleted_at', '>', now()->subDays(14))
->whereNull('status')
->pluck('username');
if($profiles->count() == 0) {
return 0;
}
foreach($profiles as $p) {
if(User::whereUsername($p)->first()->status == null) {
$pro = Profile::withTrashed()->whereUsername($p)->firstOrFail();
$pro->deleted_at = null;
$pro->save();
}
}
}
}

View file

@ -25,13 +25,10 @@ class Kernel extends ConsoleKernel
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
$schedule->command('media:optimize') $schedule->command('media:optimize')->hourly();
->hourly(); $schedule->command('media:gc')->hourly();
$schedule->command('media:gc')
->hourly();
$schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('horizon:snapshot')->everyFiveMinutes();
$schedule->command('story:gc')->everyFiveMinutes(); $schedule->command('story:gc')->everyFiveMinutes();
$schedule->command('fix:sdprofile')->everyFiveMinutes();
$schedule->command('gc:failedjobs')->dailyAt(3); $schedule->command('gc:failedjobs')->dailyAt(3);
$schedule->command('gc:passwordreset')->dailyAt('09:41'); $schedule->command('gc:passwordreset')->dailyAt('09:41');
} }