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

@@ -3,6 +3,7 @@
namespace App\Classes\FTN\Process\Netmail\Robot\Areafix;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@@ -37,18 +38,21 @@ class Area extends Base
{
$command = self::command.' '.join(' ',$this->arguments);
// If command starts with '-', its to unsubscribe
if (str_starts_with($this->arguments[0],'-')) {
$sub = FALSE;
$area = substr($this->arguments[0],1);
if (! ($area=Arr::get($this->arguments,0,NULL)))
return sprintf('%-25s <-- INVALID, AN AREA IS REQUIRED',$command);
} elseif (str_starts_with($this->arguments[0],'+')) {
// If command starts with '-', its to unsubscribe
if (str_starts_with($area,'-')) {
$sub = FALSE;
$area = substr($area,1);
} elseif (str_starts_with($area,'+')) {
$sub = TRUE;
$area = substr($this->arguments[0],1);
$area = substr($area,1);
} else {
$sub = TRUE;
$area = $this->arguments[0];
$area = $area;
}
Log::debug(sprintf('%s:- Processing [%s] for [%s]',self::LOGKEY,$sub ? 'ADD' : 'REMOVE',$area));