Move fido configuation items into fido namespace. If keeping packets move them into a date aligned subdir
This commit is contained in:
@@ -860,6 +860,8 @@ class Message extends FTNBase
|
||||
$this->point['dst'] = $t;
|
||||
|
||||
// <SOH>Via <FTN Address> @YYYYMMDD.HHMMSS[.Precise][.Time Zone] <Program Name> <Version> [Serial Number]<CR>
|
||||
// @todo The via line is still showing in the main message? https://clrghouz.bbs.dege.au/netmail/view/707
|
||||
// @todo Need to make sure that the CRC doesnt include this
|
||||
elseif ($t = $this->kludge('Via ',$kl))
|
||||
$this->via->push($t);
|
||||
|
||||
|
@@ -39,7 +39,7 @@ final class Item extends Receive
|
||||
case 'stor_name':
|
||||
return sprintf('%04X-%s',$this->ao->id,$this->recvas);
|
||||
case 'rel_name':
|
||||
return sprintf('%s/%s',config('app.fido'),$this->stor_name);
|
||||
return sprintf('%s/%s',config('fido.dir'),$this->stor_name);
|
||||
case 'full_name':
|
||||
return Storage::disk(self::LOCATION)->path($this->rel_name);
|
||||
|
||||
|
@@ -125,7 +125,7 @@ class Receive extends Base
|
||||
case self::IS_PKT:
|
||||
try {
|
||||
// If packet is greater than a size, lets queue it
|
||||
if ($this->receiving->size > config('app.queue_size',0)) {
|
||||
if ($this->receiving->size > config('fido.queue_size',0)) {
|
||||
Log::info(sprintf('%s:- Packet [%s] will be sent to the queue for processing because its [%d] size',self::LOGKEY,$this->receiving->full_name,$this->receiving->size));
|
||||
PacketProcess::dispatch($this->receiving,$this->ao,$rcvd_time);
|
||||
|
||||
|
@@ -23,7 +23,7 @@ class AreafixRequest extends FormRequest
|
||||
return [
|
||||
'to' => [
|
||||
'required',
|
||||
Rule::in(config('app.areafilefix')),
|
||||
Rule::in(config('fido.areafilefix')),
|
||||
],
|
||||
'fftn_id' => [
|
||||
'required',
|
||||
|
@@ -179,11 +179,11 @@ class MessageProcess implements ShouldQueue
|
||||
$processed = TRUE;
|
||||
|
||||
// Dont send an advisement to an areabot
|
||||
if (! in_array(strtolower($this->msg->user_from),config('app.areabots')))
|
||||
if (! in_array(strtolower($this->msg->user_from),config('fido.areabots')))
|
||||
Notification::route('netmail',$this->msg->fftn_o)->notify(new NetmailForward($this->msg,$ao));
|
||||
|
||||
// We'll ignore messages from *fix users
|
||||
} elseif (in_array(strtolower($this->msg->user_from),config('app.areabots'))) {
|
||||
} elseif (in_array(strtolower($this->msg->user_from),config('fido.areabots'))) {
|
||||
$o->flags |= Message::FLAG_RECD;
|
||||
$o->save();
|
||||
|
||||
|
@@ -11,6 +11,8 @@ use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use League\Flysystem\UnableToMoveFile;
|
||||
|
||||
use App\Classes\File;
|
||||
use App\Classes\File\Item;
|
||||
@@ -54,6 +56,8 @@ class PacketProcess implements ShouldQueue
|
||||
{
|
||||
Log::info(sprintf('%s:- Processing mail %s [%s]',self::LOGKEY,$this->file->whatType() === Item::IS_PKT ? 'PACKET' : 'ARCHIVE',$this->file->nameas));
|
||||
|
||||
$fs = Storage::disk(config('fido.local_disk'));
|
||||
|
||||
try {
|
||||
$f = new File($this->file->full_name);
|
||||
$processed = FALSE;
|
||||
@@ -79,7 +83,7 @@ class PacketProcess implements ShouldQueue
|
||||
Log::info(sprintf('%s:- Packet has [%d] messages',self::LOGKEY,$pkt->count()));
|
||||
|
||||
// Queue messages if there are too many in the packet.
|
||||
if ($queue = ($pkt->count() > config('app.queue_msgs')))
|
||||
if ($queue = ($pkt->count() > config('fido.queue_msgs')))
|
||||
Log::info(sprintf('%s:- Messages will be sent to the queue for processing',self::LOGKEY));
|
||||
|
||||
$count = 0;
|
||||
@@ -124,10 +128,34 @@ class PacketProcess implements ShouldQueue
|
||||
if (! $processed) {
|
||||
Log::alert(sprintf('%s:- Not deleting packet [%s], it doesnt seem to be processed?',self::LOGKEY,$this->file->nameas));
|
||||
|
||||
} else {
|
||||
// If we want to keep the packet, we could do that logic here
|
||||
} elseif (! config('app.packet_keep')) {
|
||||
Log::debug(sprintf('%s:- Deleting processed packet [%s]',self::LOGKEY,$this->file->full_name));
|
||||
unlink($this->file->full_name);
|
||||
if (config('fido.packet_keep')) {
|
||||
$now = Carbon::now()->format('Ymd');
|
||||
$dir = sprintf('%s/%s',config('fido.dir'),$now);
|
||||
Log::debug(sprintf('%s:- Moving processed packet [%s] to [%s]',self::LOGKEY,$this->file->rel_name,$dir));
|
||||
|
||||
try {
|
||||
if ($fs->makeDirectory($dir)) {
|
||||
$fs->move($this->file->rel_name,$x=sprintf('%s/%s',$dir,$this->file->stor_name));
|
||||
Log::info(sprintf('%s:- Moved processed packet [%s] to [%s]',self::LOGKEY,$this->file->rel_name,$x));
|
||||
|
||||
} else
|
||||
Log::error(sprintf('%s:! Unable to create dir [%s]',self::LOGKEY,$dir));
|
||||
|
||||
} catch (UnableToMoveFile $e) {
|
||||
Log::error(sprintf('%s:! Unable to move packet [%s] to [%s] (%s)',self::LOGKEY,$this->file->full_name,$dir,$e->getMessage()));
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error(sprintf('%s:! Failed moving packet [%s] to [%s] (%s)',self::LOGKEY,$this->file->full_name,$dir,$e->getMessage()));
|
||||
}
|
||||
|
||||
} else {
|
||||
Log::debug(sprintf('%s:- Deleting processed packet [%s]',self::LOGKEY,$this->file->full_name));
|
||||
|
||||
// @todo Change this to use Storage::disk()
|
||||
unlink($this->file->full_name);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (InvalidPacketException $e) {
|
||||
|
@@ -92,6 +92,7 @@ class Address extends Model
|
||||
|
||||
/**
|
||||
* Find children dependent on this record
|
||||
* @todo If bosses are defined here, and points, then mail to a point goes to it's boss
|
||||
*/
|
||||
public function children()
|
||||
{
|
||||
@@ -232,6 +233,7 @@ class Address extends Model
|
||||
*
|
||||
* @return Address|null
|
||||
* @throws \Exception
|
||||
* @todo Dont include points in this
|
||||
*/
|
||||
public function parent(): ?Address
|
||||
{
|
||||
@@ -386,7 +388,7 @@ class Address extends Model
|
||||
*
|
||||
* @param string $address
|
||||
* @param System $so
|
||||
* @return self
|
||||
* @return Address|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function createFTN(string $address,System $so): ?self
|
||||
@@ -478,8 +480,6 @@ class Address extends Model
|
||||
* Find a record in the DB for a node string, eg: 10:1/1.0
|
||||
*
|
||||
* @param string $address
|
||||
* @param bool $create
|
||||
* @param System|null $so
|
||||
* @param bool $trashed
|
||||
* @return Address|null
|
||||
* @throws \Exception
|
||||
@@ -554,6 +554,7 @@ class Address extends Model
|
||||
* @param Domain $do
|
||||
* @param int $host
|
||||
* @param int $node
|
||||
* @param int $point
|
||||
* @param bool $trashed
|
||||
* @return self|null
|
||||
* @throws \Exception
|
||||
@@ -770,7 +771,7 @@ class Address extends Model
|
||||
return NULL;
|
||||
|
||||
// Get packet type
|
||||
$type = collect(Packet::PACKET_TYPES)->get($this->system->pkt_type ?: config('app.default_pkt'));
|
||||
$type = collect(Packet::PACKET_TYPES)->get($this->system->pkt_type ?: config('fido.packet_default'));
|
||||
$o = new $type;
|
||||
$o->addressHeader($ao,$this,$passwd);
|
||||
|
||||
|
@@ -19,6 +19,8 @@ class File extends Model
|
||||
|
||||
private const LOGKEY = 'MF-';
|
||||
private bool $no_export = FALSE;
|
||||
public string $prefix = '';
|
||||
public string $replaces = '';
|
||||
|
||||
protected $casts = [
|
||||
'kludges' => CollectionOrNull::class,
|
||||
@@ -162,11 +164,31 @@ class File extends Model
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
/**
|
||||
* Return the relative path to Storage::disk() in the store
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullStoragePathAttribute(): string
|
||||
{
|
||||
return sprintf('%04X/%s',$this->filearea_id,$this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the relative path to Storage::disk() in the inbound;
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRelNameAttribute(): string
|
||||
{
|
||||
return sprintf('%s/%s',config('fido.dir'),$this->prefix_name);
|
||||
}
|
||||
|
||||
public function getPrefixNameAttribute(): string
|
||||
{
|
||||
return sprintf('%s%s',$this->prefix ? $this->prefix.'-' : '',$this->name);
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
|
||||
public function jsonSerialize(): array
|
||||
|
Reference in New Issue
Block a user