Additional syntax validation for areafix/filefix commands
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 44s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m33s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s

This commit is contained in:
2024-12-04 20:28:32 +11:00
parent 6dde4cf910
commit a65e4b8bc3
6 changed files with 54 additions and 34 deletions

View File

@@ -32,29 +32,32 @@ class Rescan extends Base
$command = self::command.' '.join(' ',$this->arguments);
if (! ($area=Arr::get($this->arguments,0)))
return sprintf('%-25s <-- INVALID, AN AREA IS REQUIRED',$command);
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 ($ea=$this->mo->fftn->domain->echoareas->where('name',$area)->pop()) {
// If already subscribed
if ($this->mo->fftn->echoareas->pluck('name')->contains($this->arguments[0])) {
if ($this->mo->fftn->echoareas->pluck('name')->contains($area)) {
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],$days));
Log::debug(sprintf('%s:- FTN [%s] RESCAN [%s] DAYS [%d]',self::LOGKEY,$this->mo->fftn->ftn,$area,$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]));
Log::debug(sprintf('%s:- FTN [%s] is NOT subscribed to [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$area));
return sprintf('%-25s <-- NOT subscribed, NO ACTION taken',$command);
}
} 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:- FTN [%s] area UNKNOWN [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$area));
return sprintf('%-25s <-- AREA UNKNOWN, NO ACTION TAKEN',$command);
}