new command
This commit is contained in:
50
app/Console/Commands/Wormholes/PurgeWormholes.php
Normal file
50
app/Console/Commands/Wormholes/PurgeWormholes.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
//Internal Library
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
//Models
|
||||||
|
use App\Models\Wormholes\AllianceWormhole;
|
||||||
|
|
||||||
|
class PurgeWormholes extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'services:PurgeWormholeData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Purge stale wormhole data automatically';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
//Time of now
|
||||||
|
$currentTime = Carbon::now();
|
||||||
|
|
||||||
|
AllianceWormhole::where('created_at', '<', $currentTime->subHours(48))->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ class Kernel extends ConsoleKernel
|
|||||||
Commands\PurgeUsers::class,
|
Commands\PurgeUsers::class,
|
||||||
Commands\FlexStructureCommand::class,
|
Commands\FlexStructureCommand::class,
|
||||||
Commands\EmptyJumpBridges::class,
|
Commands\EmptyJumpBridges::class,
|
||||||
|
Commands\PurgeWormholes::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,6 +72,9 @@ class Kernel extends ConsoleKernel
|
|||||||
$schedule->command('services:FlexStructures')
|
$schedule->command('services:FlexStructures')
|
||||||
->monthlyOn(2, '00:01')
|
->monthlyOn(2, '00:01')
|
||||||
->withoutOverlapping();
|
->withoutOverlapping();
|
||||||
|
//Wormhole data purge
|
||||||
|
$schedule->command('services:PurgeWormholeData')
|
||||||
|
->hourlyAt(20);
|
||||||
|
|
||||||
//Horizon Graph Schedule
|
//Horizon Graph Schedule
|
||||||
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
||||||
|
|||||||
Reference in New Issue
Block a user