Compare commits
2 Commits
378515d29b
...
adadbef249
Author | SHA1 | Date | |
---|---|---|---|
adadbef249 | |||
19daab24ff |
@ -25,7 +25,7 @@ final class Areafix extends Robot
|
||||
if ((strtolower($mo->to) !== 'areafix') || (! ($mo instanceof Netmail)))
|
||||
return FALSE;
|
||||
|
||||
Log::info(sprintf('%s:- Processing AREAFIX [%s] message from (%s) [%s]', self::LOGKEY, $mo->to, $mo->from, $mo->fftn->ftn));
|
||||
Log::info(sprintf('%s:- Processing AREAFIX [%s] message from (%s) [%s]',self::LOGKEY,$mo->to,$mo->from,$mo->fftn->ftn));
|
||||
|
||||
return parent::handle($mo);
|
||||
}
|
||||
@ -36,17 +36,28 @@ final class Areafix extends Robot
|
||||
$result->push('--> BEGIN <--');
|
||||
|
||||
foreach ($mo->body_lines as $command) {
|
||||
Log::debug(sprintf('%s:* Processing command [%s]',self::LOGKEY,$command));
|
||||
|
||||
// Skip empty lines
|
||||
if (! $command)
|
||||
if (! $command || preg_match('/^\s+$/',$command))
|
||||
continue;
|
||||
|
||||
$command = explode(' ',strtoupper(trim($command)));
|
||||
$command = explode(' ',strtoupper(rtrim($command)));
|
||||
Log::debug(sprintf('%s:* Processing command',self::LOGKEY),['command'=>$command]);
|
||||
|
||||
// If command starts with '...' or '---', its a tear/tag line, and we have reached the end
|
||||
if (str_starts_with($command[0],'...') || str_starts_with($command[0],'---')) {
|
||||
Log::debug(sprintf('%s:= We got a tearline/tagline, end of processing',self::LOGKEY));
|
||||
Log::info(sprintf('%s:= We got a tearline/tagline, end of processing',self::LOGKEY));
|
||||
|
||||
$result->push('--> END OF PROCESSING <--');
|
||||
$result->push('--> END OF PROCESSING - TEARLINE/TAGLINE <--');
|
||||
|
||||
break;
|
||||
|
||||
// Lines starting with a space, we'll abort
|
||||
} elseif (! $command[0]) {
|
||||
Log::info(sprintf('%s:= Got a new line with a space, end of processing',self::LOGKEY));
|
||||
|
||||
$result->push('--> END OF PROCESSING - SPACE DETECTED <--');
|
||||
|
||||
break;
|
||||
|
||||
|
@ -62,9 +62,9 @@ class Area extends Base
|
||||
if ($nea=$this->mo->fftn->echoareas->where('name',$area)->pop()) {
|
||||
// requesting to subscribe "You already are since..., arguments ignored
|
||||
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
|
||||
} else {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Classes\FTN\Process\Netmail\Robot\Areafix;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Jobs\AreafixRescan;
|
||||
@ -21,7 +22,7 @@ class Rescan extends Base
|
||||
' Arguments:',
|
||||
' - ECHOAREA (required) name of area to subscribe or unsubscribe',
|
||||
' - DAYS (optional) number of days to resend mail from this area that you',
|
||||
' If DAYS is omitted, the default is 30',
|
||||
' If DAYS is omitted, the default is 30.',
|
||||
];
|
||||
}
|
||||
|
||||
@ -31,19 +32,19 @@ class Rescan extends Base
|
||||
|
||||
$command = self::command.' '.join(' ',$this->arguments);
|
||||
|
||||
if (! is_numeric($this->arguments[1]))
|
||||
if (! is_numeric($days=Arr::get($this->arguments,1,30)))
|
||||
return sprintf('%-25s <-- INVALID, DAYS [%s] NOT NUMERIC',$command,$this->arguments[1]);
|
||||
|
||||
// Area exists
|
||||
if ($ea=$this->mo->fftn->domain->echoareas->where('name',$this->arguments[0])->pop()) {
|
||||
// If already subscribed
|
||||
if ($this->mo->fftn->echoareas->pluck('name')->contains($this->arguments[0])) {
|
||||
AreafixRescan::dispatch($this->mo->fftn,$ea,$this->arguments[1],TRUE)
|
||||
AreafixRescan::dispatch($this->mo->fftn,$ea,$days,TRUE)
|
||||
->onQueue('mail');
|
||||
|
||||
Log::debug(sprintf('%s:- FTN [%s] RESCAN [%s] DAYS [%d]',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0],$this->arguments[1]));
|
||||
Log::debug(sprintf('%s:- FTN [%s] RESCAN [%s] DAYS [%d]',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0],$days));
|
||||
|
||||
return sprintf('%-25s <-- RESCAN [%d] DAYS queued',$command,$this->arguments[1]);
|
||||
return sprintf('%-25s <-- RESCAN [%d] DAYS queued',$command,$days);
|
||||
|
||||
// If not subscribed
|
||||
} else {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Classes\FTN\Process\Netmail\Robot\Areafix;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Jobs\AreafixRescan;
|
||||
@ -22,7 +23,7 @@ class Scan extends Base
|
||||
' Arguments:',
|
||||
' - ECHOAREA (required) name of area to subscribe or unsubscribe',
|
||||
' - DAYS (optional) number of days to resend mail from this area that you',
|
||||
' If DAYS is omitted, the default is 30',
|
||||
' If DAYS is omitted, the default is 30.',
|
||||
];
|
||||
}
|
||||
|
||||
@ -32,19 +33,19 @@ class Scan extends Base
|
||||
|
||||
$command = self::command.' '.join(' ',$this->arguments);
|
||||
|
||||
if (! is_numeric($this->arguments[1]))
|
||||
if (! is_numeric($days=Arr::get($this->arguments,1,30)))
|
||||
return sprintf('%-25s <-- INVALID, DAYS [%s] NOT NUMERIC',$command,$this->arguments[1]);
|
||||
|
||||
// Area exists
|
||||
if ($ea=$this->mo->fftn->domain->echoareas->where('name',$this->arguments[0])->pop()) {
|
||||
// If already subscribed
|
||||
if ($this->mo->fftn->echoareas->pluck('name')->contains($this->arguments[0])) {
|
||||
AreafixRescan::dispatch($this->mo->fftn,$ea,$this->arguments[1])
|
||||
AreafixRescan::dispatch($this->mo->fftn,$ea,$days)
|
||||
->onQueue('mail');
|
||||
|
||||
Log::debug(sprintf('%s:- FTN [%s] SCAN [%s] DAYS [%d]',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0],$this->arguments[1]));
|
||||
Log::debug(sprintf('%s:- FTN [%s] SCAN [%s] DAYS [%d]',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0],$days));
|
||||
|
||||
return sprintf('%-25s <-- SCAN [%d] DAYS queued',$command,$this->arguments[1]);
|
||||
return sprintf('%-25s <-- SCAN [%d] DAYS queued',$command,$days);
|
||||
|
||||
// If not subscribed
|
||||
} else {
|
||||
|
@ -25,7 +25,7 @@ final class Filefix extends Robot
|
||||
if ((strtolower($mo->to) !== 'filefix') || (! ($mo instanceof Netmail)))
|
||||
return FALSE;
|
||||
|
||||
Log::info(sprintf('%s:- Processing FILEFIX [%s] message from (%s) [%s]', self::LOGKEY, $mo->to, $mo->from, $mo->fftn->ftn));
|
||||
Log::info(sprintf('%s:- Processing FILEFIX [%s] message from (%s) [%s]',self::LOGKEY,$mo->to,$mo->from,$mo->fftn->ftn));
|
||||
|
||||
return parent::handle($mo);
|
||||
}
|
||||
@ -36,17 +36,28 @@ final class Filefix extends Robot
|
||||
$result->push('--> BEGIN <--');
|
||||
|
||||
foreach ($mo->body_lines as $command) {
|
||||
Log::debug(sprintf('%s:* Processing command [%s]',self::LOGKEY,$command));
|
||||
|
||||
// Skip empty lines
|
||||
if (! $command)
|
||||
if (! $command || preg_match('/^\s+$/',$command))
|
||||
continue;
|
||||
|
||||
$command = explode(' ',strtoupper(trim($command)));
|
||||
$command = explode(' ',strtoupper(rtrim($command)));
|
||||
Log::debug(sprintf('%s:* Processing command',self::LOGKEY),['command'=>$command]);
|
||||
|
||||
// If command starts with '...' or '---', its a tear/tag line, and we have reached the end
|
||||
if (str_starts_with($command[0],'...') || str_starts_with($command[0],'---')) {
|
||||
Log::debug(sprintf('%s:= We got a tearline/tagline, end of processing',self::LOGKEY));
|
||||
Log::info(sprintf('%s:= We got a tearline/tagline, end of processing',self::LOGKEY));
|
||||
|
||||
$result->push('--> END OF PROCESSING <--');
|
||||
$result->push('--> END OF PROCESSING - TEARLINE/TAGLINE <--');
|
||||
|
||||
break;
|
||||
|
||||
// Lines starting with a space, we'll abort
|
||||
} elseif (! $command[0]) {
|
||||
Log::info(sprintf('%s:= Got a new line with a space, end of processing',self::LOGKEY));
|
||||
|
||||
$result->push('--> END OF PROCESSING - SPACE DETECTED <--');
|
||||
|
||||
break;
|
||||
|
||||
|
@ -63,9 +63,9 @@ class Area extends Base
|
||||
if ($nea=$this->mo->fftn->fileareas->where('name',$area)->pop()) {
|
||||
// requesting to subscribe "You already are since..., arguments ignored
|
||||
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
|
||||
} else {
|
||||
@ -136,7 +136,7 @@ class Area extends Base
|
||||
}
|
||||
|
||||
} else {
|
||||
Log::debug(sprintf('%s:- FTN [%s] area UNKNOWN [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$area));
|
||||
Log::debug(sprintf('%s:- FILE [%s] area UNKNOWN [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$area));
|
||||
|
||||
return sprintf('%-25s <-- AREA UNKNOWN, NO ACTION TAKEN',$command);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Classes\FTN\Process\Netmail\Robot\Filefix;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
@ -34,22 +35,22 @@ class Filelist extends Base
|
||||
|
||||
$command = self::command.' '.join(' ',$this->arguments);
|
||||
|
||||
if (! is_numeric($this->arguments[1]))
|
||||
if (! is_numeric($days=Arr::get($this->arguments,1,30)))
|
||||
return sprintf('%-25s <-- INVALID, DAYS [%s] NOT NUMERIC',$command,$this->arguments[1]);
|
||||
|
||||
if ($this->arguments[1] > 365)
|
||||
$this->arguments[1] = 365;
|
||||
if ($days > 365)
|
||||
$days = 365;
|
||||
|
||||
// Area exists
|
||||
if ($fa=$this->mo->fftn->domain->fileareas->where('name',$this->arguments[0])->pop()) {
|
||||
// If already subscribed
|
||||
if ($this->mo->fftn->fileareas->pluck('name')->contains($this->arguments[0])) {
|
||||
Notification::route('netmail',$this->mo->fftn)
|
||||
->notify(new FileListNotification($this->mo,$fa,$this->arguments[1]));
|
||||
->notify(new FileListNotification($this->mo,$fa,$days));
|
||||
|
||||
Log::debug(sprintf('%s:- FTN [%s] FILELIST [%s] DAYS [%d]',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0],$this->arguments[1]));
|
||||
Log::debug(sprintf('%s:- FTN [%s] FILELIST [%s] DAYS [%d]',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0],$days));
|
||||
|
||||
return sprintf('%-25s <-- FILELIST [%d] DAYS',$command,$this->arguments[1]);
|
||||
return sprintf('%-25s <-- FILELIST [%d] DAYS',$command,$days);
|
||||
|
||||
// If not subscribed
|
||||
} else {
|
||||
@ -59,7 +60,7 @@ class Filelist extends Base
|
||||
}
|
||||
|
||||
} else {
|
||||
Log::debug(sprintf('%s:- FTN [%s] area UNKNOWN [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0]));
|
||||
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);
|
||||
}
|
||||
|
67
app/Classes/FTN/Process/Netmail/Robot/Filefix/Rescan.php
Normal file
67
app/Classes/FTN/Process/Netmail/Robot/Filefix/Rescan.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\FTN\Process\Netmail\Robot\Filefix;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\FTN\Process\Netmail\Robot\Areafix\Base;
|
||||
use App\Jobs\FilefixRescan;
|
||||
|
||||
// RESCAN - Resend echomail
|
||||
class Rescan extends Base
|
||||
{
|
||||
private const LOGKEY = 'AFR';
|
||||
private const command = '%RESCAN';
|
||||
|
||||
public static function help(): array
|
||||
{
|
||||
return [
|
||||
self::command.' [-|+]<FILEAREA> [<DAYS>]',
|
||||
' Use the rescan command to resend files from a filearea.',
|
||||
' This is will resend files again, even if you have received them in the',
|
||||
' past.',
|
||||
' Arguments:',
|
||||
' - FILEAREA (required) name of area to subscribe or unsubscribe',
|
||||
' - DAYS (optional) number of days to resend mail from this area that you',
|
||||
' If DAYS is omitted, the default is 30. The maximum is 365.',
|
||||
];
|
||||
}
|
||||
|
||||
public function process(): string
|
||||
{
|
||||
Log::debug(sprintf('%s:- Filefix [%s] for [%s] for [%s]',self::LOGKEY,self::command,$this->mo->fftn->ftn,join('|',$this->arguments)));
|
||||
|
||||
$command = self::command.' '.join(' ',$this->arguments);
|
||||
|
||||
if (! is_numeric($days=Arr::get($this->arguments,1,30)))
|
||||
return sprintf('%-25s <-- INVALID, DAYS [%s] NOT NUMERIC',$command,$this->arguments[1]);
|
||||
|
||||
if ($days > 365)
|
||||
$days = 365;
|
||||
|
||||
// Area exists
|
||||
if ($fa=$this->mo->fftn->domain->fileareas->where('name',$this->arguments[0])->pop()) {
|
||||
// If already subscribed
|
||||
if ($this->mo->fftn->fileareas->pluck('name')->contains($this->arguments[0])) {
|
||||
FilefixRescan::dispatch($this->mo->fftn,$fa,$days,TRUE)
|
||||
->onQueue('mail');
|
||||
|
||||
Log::debug(sprintf('%s:- FTN [%s] RESCAN [%s] DAYS [%d]',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0],$days));
|
||||
|
||||
return sprintf('%-25s <-- RESCAN [%d] DAYS queued',$command,$days);
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
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);
|
||||
}
|
||||
}
|
||||
}
|
67
app/Classes/FTN/Process/Netmail/Robot/Filefix/Scan.php
Normal file
67
app/Classes/FTN/Process/Netmail/Robot/Filefix/Scan.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\FTN\Process\Netmail\Robot\Filefix;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\FTN\Process\Netmail\Robot\Areafix\Base;
|
||||
use App\Jobs\FilefixRescan;
|
||||
|
||||
// SCAN - Send unsent echomail
|
||||
class Scan extends Base
|
||||
{
|
||||
private const LOGKEY = 'AFS';
|
||||
private const command = '%SCAN';
|
||||
|
||||
public static function help(): array
|
||||
{
|
||||
return [
|
||||
self::command.' [-|+]<FILEAREA> [<DAYS>]',
|
||||
' Use the scan command to resend files that you havent received yet from an',
|
||||
' filearea. This is useful if you are rejoining an filearea, and only want',
|
||||
' to get files that you dont already have.',
|
||||
' Arguments:',
|
||||
' - FILEAREA (required) name of area to subscribe or unsubscribe',
|
||||
' - DAYS (optional) number of days to resend mail from this area that you',
|
||||
' If DAYS is omitted, the default is 30. The maximum is 365.',
|
||||
];
|
||||
}
|
||||
|
||||
public function process(): string
|
||||
{
|
||||
Log::debug(sprintf('%s:- Filefix [%s] for [%s] for [%s]',self::LOGKEY,self::command,$this->mo->fftn->ftn,join('|',$this->arguments)));
|
||||
|
||||
$command = self::command.' '.join(' ',$this->arguments);
|
||||
|
||||
if (! is_numeric($days=Arr::get($this->arguments,1,30)))
|
||||
return sprintf('%-25s <-- INVALID, DAYS [%s] NOT NUMERIC',$command,$this->arguments[1]);
|
||||
|
||||
if ($days > 365)
|
||||
$days = 365;
|
||||
|
||||
// Area exists
|
||||
if ($fa=$this->mo->fftn->domain->fileareas->where('name',$this->arguments[0])->pop()) {
|
||||
// If already subscribed
|
||||
if ($this->mo->fftn->fileareas->pluck('name')->contains($this->arguments[0])) {
|
||||
FilefixRescan::dispatch($this->mo->fftn,$fa,$days)
|
||||
->onQueue('mail');
|
||||
|
||||
Log::debug(sprintf('%s:- FTN [%s] SCAN [%s] DAYS [%d]',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0],$days));
|
||||
|
||||
return sprintf('%-25s <-- SCAN [%d] DAYS queued',$command,$days);
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -92,8 +92,8 @@ class AreafixRescan implements ShouldQueue
|
||||
->startOfDay()
|
||||
)
|
||||
->orderBy('datetime')
|
||||
->cursor() as $eo) {
|
||||
|
||||
->cursor() as $eo)
|
||||
{
|
||||
// Echomail hasnt been exported before
|
||||
if (! $eo->seenby->count()) {
|
||||
$eo->seenby()->attach($this->ao->id,['export_at'=>Carbon::now()]);
|
||||
|
@ -84,7 +84,7 @@ class FilefixRescan implements ShouldQueue
|
||||
$earliest = NULL;
|
||||
$latest = NULL;
|
||||
|
||||
foreach (File::select(['id','datetime'])
|
||||
foreach (File::select(['id','datetime','name'])
|
||||
->where('filearea_id',$this->fao->id)
|
||||
->where('datetime','>=',
|
||||
Carbon::now()
|
||||
@ -92,10 +92,10 @@ class FilefixRescan implements ShouldQueue
|
||||
->startOfDay()
|
||||
)
|
||||
->orderBy('datetime')
|
||||
->cursor() as $fo) {
|
||||
|
||||
->cursor() as $fo)
|
||||
{
|
||||
// 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()]);
|
||||
$c++;
|
||||
|
||||
@ -131,7 +131,7 @@ class FilefixRescan implements ShouldQueue
|
||||
|
||||
} else {
|
||||
$s++;
|
||||
Log::debug(sprintf('Not resending previously sent message [%d], FILE (%s) - sent on [%s]',
|
||||
Log::debug(sprintf('Not resending previously sent file [%d], FILE (%s) - sent on [%s]',
|
||||
$fo->id,
|
||||
$fo->name,
|
||||
$export->pivot->sent_at ?: '-',
|
||||
|
@ -291,6 +291,7 @@ final class Echomail extends Model implements Packet
|
||||
return $this->belongsToMany(Address::class,'echomail_seenby')
|
||||
->select(['addresses.id','zone_id','host_id','node_id'])
|
||||
->withPivot(['export_at','sent_at','sent_pkt'])
|
||||
->dontCache()
|
||||
->FTN2DOrder();
|
||||
}
|
||||
|
||||
|
@ -190,6 +190,7 @@ class File extends Model
|
||||
public function seenby()
|
||||
{
|
||||
return $this->belongsToMany(Address::class,'file_seenby')
|
||||
->dontCache()
|
||||
->ftnOrder();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user