Change the way we figure out zones in packets, some packet testing, fix Echomail import

This commit is contained in:
Deon George
2021-08-29 23:58:12 +10:00
parent 271f066667
commit 9fb6d191d0
11 changed files with 218 additions and 48 deletions

View File

@@ -16,7 +16,7 @@ class ProcessPacket extends Command
*
* @var string
*/
protected $signature = 'packet:process {pkt : Packet to process} {domain : Domain the packet is from}';
protected $signature = 'packet:process {pkt : Packet to process} {domain? : Domain the packet is from}';
/**
* The console command description.
@@ -34,14 +34,14 @@ class ProcessPacket extends Command
public function handle()
{
$f = new File($this->argument('pkt'));
$d = Domain::where('name',$this->argument('domain'))->singleOrFail();
$d = $this->argument('domain') ? Domain::where('name',$this->argument('domain'))->singleOrFail() : NULL;
foreach (Packet::open($f,$d) as $msg) {
// @todo Quick check that the packet should be processed by us.
// @todo validate that the packet's zone is in the domain.
// Dispatch job.
Job::dispatch($msg);
Job::dispatchSync($msg);
}
}
}