Move fido configuation items into fido namespace. If keeping packets move them into a date aligned subdir
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user