Compare commits
No commits in common. "1837e69520ea832a125386f07b1ae8870c11e075" and "7da09a1a9e712687b23292a711c1cf8af15e7404" have entirely different histories.
1837e69520
...
7da09a1a9e
@ -34,7 +34,6 @@ class SystemRegisterRequest extends FormRequest
|
|||||||
public function messages(): array
|
public function messages(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'heartbeat' => 'Sorry, only an admin can set this below 12',
|
|
||||||
'hold' => 'Must be Yes or No',
|
'hold' => 'Must be Yes or No',
|
||||||
'pollmode' => 'Must be Hold, Normal or Crash',
|
'pollmode' => 'Must be Hold, Normal or Crash',
|
||||||
'pkt_msgs' => 'Sorry, only an admin can increase this above 100',
|
'pkt_msgs' => 'Sorry, only an admin can increase this above 100',
|
||||||
@ -76,23 +75,14 @@ class SystemRegisterRequest extends FormRequest
|
|||||||
'active' => 'required|boolean',
|
'active' => 'required|boolean',
|
||||||
'hold' => 'sometimes|boolean',
|
'hold' => 'sometimes|boolean',
|
||||||
'pollmode' => 'required|integer|min:0|max:2',
|
'pollmode' => 'required|integer|min:0|max:2',
|
||||||
'heartbeat' => [
|
'heartbeat' => 'nullable|integer|min:0|max:48',
|
||||||
'nullable',
|
|
||||||
'integer',
|
|
||||||
function ($attribute,$value,$fail) {
|
|
||||||
if (($value < 12) && (! Gate::allows('admin')))
|
|
||||||
$fail(true);
|
|
||||||
},
|
|
||||||
'min:0',
|
|
||||||
'max:48'
|
|
||||||
],
|
|
||||||
'pkt_msgs' => [
|
'pkt_msgs' => [
|
||||||
'nullable',
|
'nullable',
|
||||||
'integer',
|
|
||||||
function ($attribute,$value,$fail) {
|
function ($attribute,$value,$fail) {
|
||||||
if (($value > 100) && (! Gate::allows('admin')))
|
if (($value > 100) && (! Gate::allows('admin')))
|
||||||
$fail(true);
|
$fail(true);
|
||||||
},
|
},
|
||||||
|
'integer',
|
||||||
'min:5',
|
'min:5',
|
||||||
'max:65535',
|
'max:65535',
|
||||||
],
|
],
|
||||||
|
@ -27,7 +27,7 @@ class AddressPoll implements ShouldQueue, ShouldBeUnique
|
|||||||
|
|
||||||
private const LOGKEY = 'JAP';
|
private const LOGKEY = 'JAP';
|
||||||
|
|
||||||
public int $tries = 10;
|
public int $tries = 5;
|
||||||
public int $maxExceptions = 1;
|
public int $maxExceptions = 1;
|
||||||
public bool $failOnTimeout = TRUE;
|
public bool $failOnTimeout = TRUE;
|
||||||
|
|
||||||
|
@ -254,28 +254,20 @@ class Address extends Model
|
|||||||
$ftn = self::parseFTN($address);
|
$ftn = self::parseFTN($address);
|
||||||
$do = $ftn['d'] ? Domain::where('name',$ftn['d'])->single() : NULL;
|
$do = $ftn['d'] ? Domain::where('name',$ftn['d'])->single() : NULL;
|
||||||
|
|
||||||
|
if ($ftn['z'] === 0)
|
||||||
|
Log::alert(sprintf('%s:! newFTN was parsed an FTN [%s] with a zero zone',self::LOGKEY,$address));
|
||||||
|
|
||||||
|
$zo = Zone::where('zone_id',$ftn['z'])
|
||||||
|
->when($do,fn($query)=>$query->where('domain_id',$do->id))
|
||||||
|
->single();
|
||||||
|
|
||||||
$o = new self;
|
$o = new self;
|
||||||
|
$o->zone_id = $zo?->id;
|
||||||
$o->region_id = $ftn['r'];
|
$o->region_id = $ftn['r'];
|
||||||
$o->host_id = $ftn['n'];
|
$o->host_id = $ftn['n'];
|
||||||
$o->node_id = $ftn['f'];
|
$o->node_id = $ftn['f'];
|
||||||
$o->point_id = $ftn['p'];
|
$o->point_id = $ftn['p'];
|
||||||
|
|
||||||
if ($ftn['z'] === 0) {
|
|
||||||
Log::alert(sprintf('%s:! newFTN was parsed an FTN [%s] with a zero zone, adding empty zone in domain',self::LOGKEY,$address));
|
|
||||||
|
|
||||||
$zo = new Zone;
|
|
||||||
$zo->domain_id = $do?->id;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$zo = Zone::where('zone_id',$ftn['z'])
|
|
||||||
->when($do,fn($query)=>$query->where('domain_id',$do->id))
|
|
||||||
->single();
|
|
||||||
|
|
||||||
$o->zone_id = $zo?->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$o->zone()->associate($zo);
|
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,9 +761,6 @@ class Address extends Model
|
|||||||
if (! $this->relationLoaded('zone'))
|
if (! $this->relationLoaded('zone'))
|
||||||
$this->load(['zone:id,domain_id,zone_id']);
|
$this->load(['zone:id,domain_id,zone_id']);
|
||||||
|
|
||||||
if (! $this->zone)
|
|
||||||
throw new InvalidFTNException(sprintf('Invalid Zone for FTN address [%d/%d.%d@%s]',$this->host_id ?: $this->region_id,$this->node_id,$this->point_id,$this->domain?->name));
|
|
||||||
|
|
||||||
return sprintf('%d:%s',$this->zone->zone_id,$this->getFTN2DAttribute());
|
return sprintf('%d:%s',$this->zone->zone_id,$this->getFTN2DAttribute());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user