Some BINKP optimisation, implemented crypt, implemented receiving compressed transfers

This commit is contained in:
2023-07-02 23:40:08 +10:00
parent f9f9fb5345
commit 6f298d778f
28 changed files with 1614 additions and 904 deletions

View File

@@ -72,6 +72,16 @@ class Address extends Model
->FTNorder();
}
public function scopeTrashed($query)
{
return $query->select($this->getTable().'.*')
->join('zones',['zones.id'=>'addresses.zone_id'])
->join('domains',['domains.id'=>'zones.domain_id'])
->orderBy('domains.name')
->withTrashed()
->FTNorder();
}
public function scopeFTNOrder($query)
{
return $query
@@ -371,13 +381,18 @@ class Address extends Model
* @return Address|null
* @throws \Exception
*/
public static function findFTN(string $address,bool $create=FALSE,System $so=NULL): ?self
public static function findFTN(string $address,bool $create=FALSE,System $so=NULL,bool $trashed=FALSE): ?self
{
$ftn = self::parseFTN($address);
// Are we looking for a region address
if (($ftn['f'] === 0) && $ftn['p'] === 0) {
$o = (new self)->active()
$o = (new self)
->when($trashed,function($query) {
$query->trashed();
},function($query) {
$query->active();
})
->where('zones.zone_id',$ftn['z'])
->where(function($q) use ($ftn) {
return $q
@@ -400,7 +415,12 @@ class Address extends Model
return $o;
}
$o = (new self)->active()
$o = (new self)
->when($trashed,function($query) {
$query->trashed();
},function($query) {
$query->active();
})
->where('zones.zone_id',$ftn['z'])
->where(function($q) use ($ftn) {
return $q->where(function($qq) use ($ftn) {