clrghouz/app/Console/Commands/Debug/DynamicItem.php
Deon George 2458ca2408
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 38s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m38s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s
Fix nodelist segment being sent from queue where gethostname() is only a container name, added ability to control filename when sending nodelist segment
2025-03-18 17:26:17 +11:00

35 lines
756 B
PHP

<?php
namespace App\Console\Commands\Debug;
use Illuminate\Console\Command;
use App\Classes\File\Send;
use App\Classes\File\Send\Dynamic;
use App\Models\Address;
use App\Models\Dynamic as DynamicModel;
class DynamicItem extends Command
{
protected $signature = 'debug:dynamic:item'
.' {name : Dynamic Item}';
protected $description = 'Generate a dynamic item';
public function handle(): int
{
$do = DynamicModel::where('name',$this->argument('name'))->single();
if (! $do)
throw new \Exception(sprintf('Dynamic Item [%s] doesnt exist?',$this->argument('name')));
$d = new Dynamic($do,$do->address,Send::T_FILE);
$d->open();
echo $d->read($d->size)."\n";
$this->alert('File sent as:'.$d->nameas);
return self::SUCCESS;
}
}