coolify/app/Events/S3DownloadFinished.php
Andras Bacsai 3fc626c6da fix: create S3 event classes and add formatBytes helper
- 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>
2025-11-14 10:43:20 +01:00

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);
}
}
}