Compare commits
2 Commits
378515d29b
...
adadbef249
Author | SHA1 | Date | |
---|---|---|---|
adadbef249 | |||
19daab24ff |
app
@ -62,9 +62,9 @@ class Area extends Base
|
|||||||
if ($nea=$this->mo->fftn->echoareas->where('name',$area)->pop()) {
|
if ($nea=$this->mo->fftn->echoareas->where('name',$area)->pop()) {
|
||||||
// requesting to subscribe "You already are since..., arguments ignored
|
// requesting to subscribe "You already are since..., arguments ignored
|
||||||
if ($sub) {
|
if ($sub) {
|
||||||
Log::debug(sprintf('%s:- FTN [%s] ALREADY subscribed to [%s] since [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area,$nea->pivot->subscribed->format('Y-m-d H:i')));
|
Log::debug(sprintf('%s:- FTN [%s] ALREADY subscribed to [%s] since [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area,$nea->pivot->subscribed));
|
||||||
|
|
||||||
return sprintf('%-25s <-- ALREADY subscribed since %s',$command,$nea->pivot->subscribed->format('Y-m-d H:i'));
|
return sprintf('%-25s <-- ALREADY subscribed since %s',$command,$nea->pivot->subscribed);
|
||||||
|
|
||||||
// requesting to unsubscribe
|
// requesting to unsubscribe
|
||||||
} else {
|
} else {
|
||||||
|
@ -63,9 +63,9 @@ class Area extends Base
|
|||||||
if ($nea=$this->mo->fftn->fileareas->where('name',$area)->pop()) {
|
if ($nea=$this->mo->fftn->fileareas->where('name',$area)->pop()) {
|
||||||
// requesting to subscribe "You already are since..., arguments ignored
|
// requesting to subscribe "You already are since..., arguments ignored
|
||||||
if ($sub) {
|
if ($sub) {
|
||||||
Log::debug(sprintf('%s:- FTN [%s] ALREADY subscribed to [%s] since [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area,$nea->pivot->subscribed->format('Y-m-d H:i')));
|
Log::debug(sprintf('%s:- FTN [%s] ALREADY subscribed to [%s] since [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area,$nea->pivot->subscribed));
|
||||||
|
|
||||||
return sprintf('%-25s <-- ALREADY subscribed since %s',$command,$nea->pivot->subscribed->format('Y-m-d H:i'));
|
return sprintf('%-25s <-- ALREADY subscribed since %s',$command,$nea->pivot->subscribed);
|
||||||
|
|
||||||
// requesting to unsubscribe
|
// requesting to unsubscribe
|
||||||
} else {
|
} else {
|
||||||
|
79
app/Classes/FTN/Process/Netmail/Robot/Filefix/Resend.php
Normal file
79
app/Classes/FTN/Process/Netmail/Robot/Filefix/Resend.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Classes\FTN\Process\Netmail\Robot\Filefix;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
use App\Classes\FTN\Process\Netmail\Robot\Areafix\Base;
|
||||||
|
|
||||||
|
// Resend a file
|
||||||
|
class Resend extends Base
|
||||||
|
{
|
||||||
|
private const LOGKEY = 'FFA';
|
||||||
|
|
||||||
|
private const command = '%RESEND';
|
||||||
|
|
||||||
|
public static function help(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
self::command.' <FILEAREA> <FILENAME>',
|
||||||
|
' Resend a file from a file area',
|
||||||
|
' Arguments:',
|
||||||
|
' - FILEAREA (required) name of area to subscribe or unsubscribe',
|
||||||
|
' - FILENAME (required) number of file to resend',
|
||||||
|
' Notes:',
|
||||||
|
' * You can obtain a list of files in an area with %FILELIST <FILEAREA>',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function process(): string
|
||||||
|
{
|
||||||
|
$command = self::command.' '.join(' ',$this->arguments);
|
||||||
|
|
||||||
|
if (count($this->arguments) < 2)
|
||||||
|
return sprintf('%-25s <-- INVALID, NOT ENOUGH ARGUMENTS',$command);
|
||||||
|
elseif (count($this->arguments) > 2)
|
||||||
|
return sprintf('%-25s <-- INVALID, TOO MANU ARGUMENTS',$command);
|
||||||
|
|
||||||
|
Log::debug(sprintf('%s:- Resending [%s] from [%s] to [%s]',self::LOGKEY,$this->arguments[1],$this->arguments[0],$this->mo->fftn->ftn));
|
||||||
|
|
||||||
|
// Area exists
|
||||||
|
if ($fa=$this->mo->fftn->domain->fileareas->where('name',$this->arguments[0])->pop()) {
|
||||||
|
// If already subscribed
|
||||||
|
if ($nea=$this->mo->fftn->fileareas->where('name',$fa->name)->pop()) {
|
||||||
|
// Check the file is in the area
|
||||||
|
if ($fo=$nea->files()->where('name','ilike',$this->arguments[1])->single()) {
|
||||||
|
// File hasnt been exported before
|
||||||
|
if (! $fo->seenby->where('id',$this->mo->fftn_id)->count()) {
|
||||||
|
Log::info(sprintf('Exported [%d] FILE (%s) dated (%s) to [%s]',$fo->id,$fo->name,$fo->datetime->format('Y-m-d H:i:s'),$this->mo->fftn->ftn3d));
|
||||||
|
$fo->seenby()->attach($this->mo->fftn_id,['export_at'=>Carbon::now()]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log::debug(sprintf('Re-exported [%d] FILE (%s) dated (%s) to [%s]',$fo->id,$fo->name,$fo->datetime,$this->mo->fftn->ftn3d));
|
||||||
|
$fo->seenby()->updateExistingPivot($this->mo->fftn_id,['export_at'=>Carbon::now(),'sent_at'=>NULL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf('%-25s <-- FILE QUEUED TO RESEND',$command);
|
||||||
|
|
||||||
|
// No file in area
|
||||||
|
} else {
|
||||||
|
Log::debug(sprintf('%s:- FTN [%s] doesnt have a file [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[1]));
|
||||||
|
|
||||||
|
return sprintf('%-25s <-- FILE NOT FOUND, NO ACTION taken',$command);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not subscribed
|
||||||
|
} else {
|
||||||
|
Log::debug(sprintf('%s:- FTN [%s] is NOT subscribed to [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0]));
|
||||||
|
|
||||||
|
return sprintf('%-25s <-- NOT subscribed, NO ACTION taken',$command);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log::debug(sprintf('%s:- FILE [%s] area UNKNOWN [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0]));
|
||||||
|
|
||||||
|
return sprintf('%-25s <-- AREA UNKNOWN, NO ACTION TAKEN',$command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -95,7 +95,7 @@ class FilefixRescan implements ShouldQueue
|
|||||||
->cursor() as $fo)
|
->cursor() as $fo)
|
||||||
{
|
{
|
||||||
// File hasnt been exported before
|
// File hasnt been exported before
|
||||||
if (! $fo->seenby->count()) {
|
if (! $fo->seenby->where('address_id',$this->ao->id)->count()) {
|
||||||
$fo->seenby()->attach($this->ao->id,['export_at'=>Carbon::now()]);
|
$fo->seenby()->attach($this->ao->id,['export_at'=>Carbon::now()]);
|
||||||
$c++;
|
$c++;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user