Remove Address::downstream() for Address::downlinks()

This commit is contained in:
Deon George 2024-11-25 23:24:21 +11:00
parent bc3407e9d4
commit 7a7d7b369e
3 changed files with 19 additions and 32 deletions

View File

@ -24,7 +24,7 @@ class AddressCheck extends Command
$this->info(sprintf('Address: %s (%s)',$o->ftn,$o->role_name)); $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("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('Uplink: %s (Parent: %s)',$o->uplink()?->ftn,$o->parent()?->ftn));
$this->info(sprintf('Our Address: %s',our_address($o)?->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(','))); $this->info(sprintf('- Domain Addresses: %s',our_address($o->zone->domain)->pluck('ftn4d')->join(',')));

View File

@ -25,7 +25,8 @@ class ZoneCheck extends Command
$this->warn('Zone: '.$zo->zone_id); $this->warn('Zone: '.$zo->zone_id);
$this->info(sprintf('- Our address(es): %s',our_address($do)->pluck('ftn4d')->join(','))); $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) { $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 [ return [
'id'=>$item->id, 'id'=>$item->id,
'ftn'=>$item->ftn4d, 'ftn'=>$item->ftn4d,

View File

@ -1062,20 +1062,6 @@ class Address extends Model
return $children->diff($exclude); 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 * 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 // Addresses that our downstream of this address, except anybody that has session details with us
$ours = our_nodes($this->zone->domain)->pluck('id'); $ours = our_nodes($this->zone->domain)->pluck('id');
$addresses = $this->downstream() $addresses = $this->downlinks()
->filter(fn($item)=>! $ours->contains($item->id)) ->filter(fn($item)=>(! $ours->contains($item->id)))
->merge($this->system->match($this->zone,Address::NODE_ALL)); ->merge($this->system->match($this->zone,Address::NODE_ALL));
$netmails = $this $netmails = $this