diff --git a/app/Jobs/NodelistImport.php b/app/Jobs/NodelistImport.php index e664938..5c6510d 100644 --- a/app/Jobs/NodelistImport.php +++ b/app/Jobs/NodelistImport.php @@ -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));