- Add path attribute mutator to S3Storage model ensuring paths start with / - Add updatedS3Path hook to normalize path and reset validation state on blur - Add updatedS3StorageId hook to reset validation state when storage changes - Add Enter key support to trigger file check from path input - Use wire:model.live for S3 storage select, wire:model.blur for path input - Improve shell escaping in restore job cleanup commands - Fix isSafeTmpPath helper logic for directory validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use App\Models\Server;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class RestoreJobFinished
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public function __construct($data)
|
|
{
|
|
$scriptPath = data_get($data, 'scriptPath');
|
|
$tmpPath = data_get($data, 'tmpPath');
|
|
$container = data_get($data, 'container');
|
|
$serverId = data_get($data, 'serverId');
|
|
|
|
if (filled($container) && filled($serverId)) {
|
|
$commands = [];
|
|
|
|
if (isSafeTmpPath($scriptPath)) {
|
|
$commands[] = "docker exec {$container} sh -c 'rm ".escapeshellarg($scriptPath)." 2>/dev/null || true'";
|
|
}
|
|
|
|
if (isSafeTmpPath($tmpPath)) {
|
|
$commands[] = "docker exec {$container} sh -c 'rm ".escapeshellarg($tmpPath)." 2>/dev/null || true'";
|
|
}
|
|
|
|
if (! empty($commands)) {
|
|
$server = Server::find($serverId);
|
|
if ($server) {
|
|
instant_remote_process($commands, $server, throwError: false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|