- Create S3DownloadFinished event to cleanup MinIO containers - Create S3RestoreJobFinished event to cleanup temp files and S3 downloads - Add formatBytes() helper function for human-readable file sizes - Update Import component to use full Event class names in callEventOnFinish - Fix activity monitor visibility issues with proper event dispatching 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
27 lines
835 B
PHP
27 lines
835 B
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use App\Models\Server;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class S3DownloadFinished
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public function __construct($data)
|
|
{
|
|
$containerName = data_get($data, 'containerName');
|
|
$serverId = data_get($data, 'serverId');
|
|
|
|
if (filled($containerName) && filled($serverId)) {
|
|
// Clean up the MinIO client container
|
|
$commands = [];
|
|
$commands[] = "docker stop {$containerName} 2>/dev/null || true";
|
|
$commands[] = "docker rm {$containerName} 2>/dev/null || true";
|
|
instant_remote_process($commands, Server::find($serverId), throwError: false);
|
|
}
|
|
}
|
|
}
|