Rework TIC processing to use Storage::disk(). Implemented handling of replaces and files that already exist
This commit is contained in:
@@ -137,7 +137,7 @@ class PacketProcess implements ShouldQueue
|
||||
|
||||
try {
|
||||
if ($fs->makeDirectory($dir)) {
|
||||
$fs->move($this->file->rel_name,$x=sprintf('%s/%s',$dir,$this->file->stor_name));
|
||||
$fs->move($this->file->rel_name,$x=sprintf('%s/%s',$dir,$this->file->pref_name));
|
||||
Log::info(sprintf('%s:- Moved processed packet [%s] to [%s]',self::LOGKEY,$this->file->rel_name,$x));
|
||||
|
||||
} else
|
||||
|
@@ -10,6 +10,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
use App\Classes\FTN\Tic;
|
||||
use App\Models\Domain;
|
||||
@@ -27,7 +28,7 @@ class TicProcess implements ShouldQueue
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $file Relative to Storage::disk('local'), ie: storage/app
|
||||
* @param string|null $domain
|
||||
*/
|
||||
public function __construct(private string $file,private ?string $domain=NULL)
|
||||
@@ -56,12 +57,15 @@ class TicProcess implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$fs = Storage::disk(config('fido.local_disk'));
|
||||
|
||||
$to = new Tic;
|
||||
$to->load(storage_path('app').'/'.$this->file);
|
||||
$to->load($this->file);
|
||||
|
||||
Log::info(sprintf('%s:= Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->name,$to->fo->id));
|
||||
|
||||
unlink(storage_path('app').'/'.$this->file);
|
||||
if (! $fs->delete($this->file))
|
||||
Log::alert(sprintf('%s:! Failed to delete [%s]',self::LOGKEY,$this->file));
|
||||
|
||||
if ($to->isNodelist())
|
||||
NodelistImport::dispatch($to->fo,$this->domain);
|
||||
|
Reference in New Issue
Block a user