clrghouz/app/Console/Commands/NodelistImport.php

50 lines
1.0 KiB
PHP
Raw Permalink Normal View History

2019-04-26 04:30:00 +00:00
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
2021-06-25 11:31:57 +00:00
use App\Jobs\NodelistImport as Job;
use App\Models\File;
2019-04-26 04:30:00 +00:00
class NodelistImport extends Command
2019-04-26 04:30:00 +00:00
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'nodelist:import'
.' {file : File ID | filename}'
.' {domain? : Domain Name}'
.' {--I|ignorecrc : Ignore the CRC}'
2021-08-21 11:15:22 +00:00
.' {--D|delete : Delete old data for the date}'
2023-09-07 02:24:01 +00:00
.' {--U|unlink : Delete file after import}'
.' {--T|test : Dry run}';
2019-04-26 04:30:00 +00:00
/**
* The console command description.
*
* @var string
*/
protected $description = 'Import Nodelist';
/**
* Execute the console command.
*
* @return int
2019-04-26 04:30:00 +00:00
*/
public function handle():int
2019-04-26 04:30:00 +00:00
{
2024-06-15 04:23:05 +00:00
return Job::dispatchSync(
is_numeric($x=$this->argument('file'))
? File::findOrFail($x)
: sprintf('%s/%s',config('fido.dir'),$this->argument('file')),
$this->argument('domain'),
$this->option('delete'),
$this->option('unlink'),
$this->option('test'),
$this->option('ignorecrc'),
);
2019-04-26 04:30:00 +00:00
}
}