diff --git a/app/Console/Commands/Debug/AddressCheck.php b/app/Console/Commands/Debug/AddressCheck.php index 1b37bf1..bd27ff3 100644 --- a/app/Console/Commands/Debug/AddressCheck.php +++ b/app/Console/Commands/Debug/AddressCheck.php @@ -24,7 +24,7 @@ class AddressCheck extends Command $this->info(sprintf('Address: %s (%s)',$o->ftn,$o->role_name)); $this->info(sprintf("Children: \n- %s",$o->children()->pluck('ftn4d')->join("\n- "))); - $this->info(sprintf("Downstream: \n- %s",$o->downstream()->pluck('ftn4d')->join("\n- "))); + $this->info(sprintf("Downlinks: \n- %s",$o->downlinks()->pluck('ftn4d')->join("\n- "))); $this->info(sprintf('Uplink: %s (Parent: %s)',$o->uplink()?->ftn,$o->parent()?->ftn)); $this->info(sprintf('Our Address: %s',our_address($o)?->ftn)); $this->info(sprintf('- Domain Addresses: %s',our_address($o->zone->domain)->pluck('ftn4d')->join(','))); diff --git a/app/Console/Commands/Debug/ZoneCheck.php b/app/Console/Commands/Debug/ZoneCheck.php index 9e4acbf..228846c 100644 --- a/app/Console/Commands/Debug/ZoneCheck.php +++ b/app/Console/Commands/Debug/ZoneCheck.php @@ -25,21 +25,22 @@ class ZoneCheck extends Command $this->warn('Zone: '.$zo->zone_id); $this->info(sprintf('- Our address(es): %s',our_address($do)->pluck('ftn4d')->join(','))); - $this->table(['id','ftn','role','parent','children','downlinks','uplink','send from','region_id','system','notes'],$zo->addresses()->FTNorder()->active()->with(['system'])->get()->transform(function($item) { - return [ - 'id'=>$item->id, - 'ftn'=>$item->ftn4d, - 'role'=>$item->role_name, - 'parent'=>$item->parent()?->ftn4d, - 'children'=>$item->children()->count(), - 'downlinks'=>$item->downlinks()->count(), - 'uplink'=>($x=$item->uplink())?->ftn4d, - 'send from'=>$x ? our_address($item->uplink())?->ftn4d : '', - 'region_id'=>$item->region_id, - 'system'=>$item->system->name, - 'notes'=>$item->isRoleOverride() ? 'Role Override' : '', - ]; - })); + $this->table(['id','ftn','role','parent','children','downlinks','uplink','send from','region_id','system','notes'], + $zo->addresses()->FTN()->active()->with(['system','nodes_hub'])->get()->transform(function($item) { + return [ + 'id'=>$item->id, + 'ftn'=>$item->ftn4d, + 'role'=>$item->role_name, + 'parent'=>$item->parent()?->ftn4d, + 'children'=>$item->children()->count(), + 'downlinks'=>$item->downlinks()->count(), + 'uplink'=>($x=$item->uplink())?->ftn4d, + 'send from'=>$x ? our_address($item->uplink())?->ftn4d : '', + 'region_id'=>$item->region_id, + 'system'=>$item->system->name, + 'notes'=>$item->isRoleOverride() ? 'Role Override' : '', + ]; + })); } return self::SUCCESS; diff --git a/app/Models/Address.php b/app/Models/Address.php index d3eb732..52d11b4 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -1062,20 +1062,6 @@ class Address extends Model return $children->diff($exclude); } - /** - * List of all our nodes and their children - * - * @return \Illuminate\Support\Collection - * @throws \Exception - * @deprecated use children() - */ - public function downstream(): \Illuminate\Support\Collection - { - return $this->downlinks()->transform(function($item) { - return $item->nodes()->push($item); - })->flatten(); - } - /** * Files waiting to be sent to this system * @@ -1266,8 +1252,8 @@ class Address extends Model // Addresses that our downstream of this address, except anybody that has session details with us $ours = our_nodes($this->zone->domain)->pluck('id'); - $addresses = $this->downstream() - ->filter(fn($item)=>! $ours->contains($item->id)) + $addresses = $this->downlinks() + ->filter(fn($item)=>(! $ours->contains($item->id))) ->merge($this->system->match($this->zone,Address::NODE_ALL)); $netmails = $this