For nodelist import, find based on mailer_address first

This commit is contained in:
Deon George 2021-09-11 18:00:39 +10:00
parent 7e176d7bc1
commit ff2b246d31

View File

@ -295,15 +295,14 @@ class NodelistImport implements ShouldQueue
// We'll search and see if we already have that system
} else {
$so = System::where(function ($q) use ($system,$sysop) {
return $q->where('name',$system)
->where('sysop',$sysop);
})
->orWhere(function ($q) use ($address,$port) {
return $q->where('mailer_address',$address)
->where('mailer_port',$port);
})
->firstOrNew();
$so = System::where('mailer_address',$address)
->where('mailer_port',$port)
->single();
if (! $so)
$so = System::where('name',$system)
->where('sysop',$sysop)
->firstOrNew();
if ($so->exists)
Log::debug(sprintf('%s:Linking address [%d:%d/%d] to [%s:%s]',self::LOGKEY,$zo->zone_id,$ao->host_id,$ao->node_id,$so->id,$so->name));