Add domain to TIC processing, for nodelists that dont have a domain

This commit is contained in:
Deon George 2022-11-11 23:34:33 +11:00
parent 9f0fa242e6
commit b158bb5a7d
2 changed files with 11 additions and 4 deletions

View File

@ -13,7 +13,9 @@ class TicProcess extends Command
*
* @var string
*/
protected $signature = 'tic:process {file : TIC file}';
protected $signature = 'tic:process'
.' {file : TIC file}'
.' {domain? : Domain Name}';
/**
* The console command description.
@ -30,7 +32,7 @@ class TicProcess extends Command
public function handle()
{
// Dispatch job.
Job::dispatchSync($this->argument('file'));
Job::dispatchSync($this->argument('file'),$this->argument('domain'));
return Command::SUCCESS;
}

View File

@ -12,6 +12,7 @@ use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use App\Classes\FTN\Tic;
use App\Models\Domain;
class TicProcess implements ShouldQueue
{
@ -19,13 +20,17 @@ class TicProcess implements ShouldQueue
private const LOGKEY = 'JTP';
private ?Domain $do;
/**
* Create a new job instance.
*
* @param string $file
* @param string|null $domain
*/
public function __construct(private string $file)
public function __construct(private string $file,private ?string $domain=NULL)
{
$this->do = $domain ? Domain::where('name',$domain)->singleOrFail() : NULL;
}
/**
@ -43,6 +48,6 @@ class TicProcess implements ShouldQueue
unlink($this->file);
if ($to->isNodelist())
NodelistImport::dispatch($to->fo);
NodelistImport::dispatch($to->fo,$this->domain);
}
}