Implemented filefix %SCAN/%RESCAN, and some cosmetic cleanup

This commit is contained in:
2024-11-28 22:07:39 +11:00
parent 0e1086c99f
commit ce19985c2d
13 changed files with 216 additions and 55 deletions

View File

@@ -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 {