refactor(actions): standardize method naming for network and configuration deletion across application and service classes
This commit is contained in:
parent
ed0961e0dc
commit
019ed43448
24 changed files with 123 additions and 117 deletions
|
|
@ -30,7 +30,7 @@ public function handle(Application $application, bool $previewDeployments = fals
|
|||
$application->stopContainers($containersToStop, $server);
|
||||
|
||||
if ($application->build_pack === 'dockercompose') {
|
||||
$application->delete_connected_networks($application->uuid);
|
||||
$application->deleteConnectedNetworks();
|
||||
}
|
||||
|
||||
if ($dockerCleanup) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public function handle(Service $service, bool $deleteConfigurations, bool $delet
|
|||
}
|
||||
|
||||
if ($deleteConnectedNetworks) {
|
||||
$service->delete_connected_networks($service->uuid);
|
||||
$service->deleteConnectedNetworks();
|
||||
}
|
||||
|
||||
instant_remote_process(["docker rm -f $service->uuid"], $server, throwError: false);
|
||||
|
|
@ -56,7 +56,7 @@ public function handle(Service $service, bool $deleteConfigurations, bool $delet
|
|||
throw new \Exception($e->getMessage());
|
||||
} finally {
|
||||
if ($deleteConfigurations) {
|
||||
$service->delete_configurations();
|
||||
$service->deleteConfigurations();
|
||||
}
|
||||
foreach ($service->applications()->get() as $application) {
|
||||
$application->forceDelete();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public function handle(Service $service, bool $isDeleteOperation = false, bool $
|
|||
$service->stopContainers($containersToStop, $server);
|
||||
|
||||
if ($isDeleteOperation) {
|
||||
$service->delete_connected_networks($service->uuid);
|
||||
$service->deleteConnectedNetworks();
|
||||
if ($dockerCleanup) {
|
||||
CleanupDocker::dispatch($server, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,21 +12,22 @@ class ApplicationStatusChanged implements ShouldBroadcast
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $teamId;
|
||||
public ?int $teamId = null;
|
||||
|
||||
public function __construct($teamId = null)
|
||||
{
|
||||
if (is_null($teamId)) {
|
||||
$teamId = auth()->user()->currentTeam()->id ?? null;
|
||||
}
|
||||
if (is_null($teamId)) {
|
||||
throw new \Exception('Team id is null');
|
||||
if (is_null($teamId) && auth()->check() && auth()->user()->currentTeam()) {
|
||||
$teamId = auth()->user()->currentTeam()->id;
|
||||
}
|
||||
$this->teamId = $teamId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
if (is_null($this->teamId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
new PrivateChannel("team.{$this->teamId}"),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -12,21 +12,22 @@ class BackupCreated implements ShouldBroadcast
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $teamId;
|
||||
public ?int $teamId = null;
|
||||
|
||||
public function __construct($teamId = null)
|
||||
{
|
||||
if (is_null($teamId)) {
|
||||
$teamId = auth()->user()->currentTeam()->id ?? null;
|
||||
}
|
||||
if (is_null($teamId)) {
|
||||
throw new \Exception('Team id is null');
|
||||
if (is_null($teamId) && auth()->check() && auth()->user()->currentTeam()) {
|
||||
$teamId = auth()->user()->currentTeam()->id;
|
||||
}
|
||||
$this->teamId = $teamId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
if (is_null($this->teamId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
new PrivateChannel("team.{$this->teamId}"),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -12,21 +12,22 @@ class CloudflareTunnelConfigured implements ShouldBroadcast
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $teamId;
|
||||
public ?int $teamId = null;
|
||||
|
||||
public function __construct($teamId = null)
|
||||
{
|
||||
if (is_null($teamId)) {
|
||||
$teamId = auth()->user()->currentTeam()->id ?? null;
|
||||
}
|
||||
if (is_null($teamId)) {
|
||||
throw new \Exception('Team id is null');
|
||||
if (is_null($teamId) && auth()->check() && auth()->user()->currentTeam()) {
|
||||
$teamId = auth()->user()->currentTeam()->id;
|
||||
}
|
||||
$this->teamId = $teamId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
if (is_null($this->teamId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
new PrivateChannel("team.{$this->teamId}"),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -7,27 +7,27 @@
|
|||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class DatabaseProxyStopped implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $teamId;
|
||||
public ?int $teamId = null;
|
||||
|
||||
public function __construct($teamId = null)
|
||||
{
|
||||
if (is_null($teamId)) {
|
||||
$teamId = Auth::user()?->currentTeam()?->id ?? null;
|
||||
}
|
||||
if (is_null($teamId)) {
|
||||
throw new \Exception('Team id is null');
|
||||
if (is_null($teamId) && auth()->check() && auth()->user()->currentTeam()) {
|
||||
$teamId = auth()->user()->currentTeam()->id;
|
||||
}
|
||||
$this->teamId = $teamId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
if (is_null($this->teamId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
new PrivateChannel("team.{$this->teamId}"),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -13,28 +13,24 @@ class DatabaseStatusChanged implements ShouldBroadcast
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $userId = null;
|
||||
public int|string|null $userId = null;
|
||||
|
||||
public function __construct($userId = null)
|
||||
{
|
||||
if (is_null($userId)) {
|
||||
$userId = Auth::id() ?? null;
|
||||
}
|
||||
if (is_null($userId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): ?array
|
||||
{
|
||||
if (! is_null($this->userId)) {
|
||||
return [
|
||||
new PrivateChannel("user.{$this->userId}"),
|
||||
];
|
||||
if (is_null($this->userId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return null;
|
||||
return [
|
||||
new PrivateChannel("user.{$this->userId}"),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,18 +12,22 @@ class FileStorageChanged implements ShouldBroadcast
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $teamId;
|
||||
public ?int $teamId = null;
|
||||
|
||||
public function __construct($teamId = null)
|
||||
{
|
||||
if (is_null($teamId)) {
|
||||
throw new \Exception('Team id is null');
|
||||
if (is_null($teamId) && auth()->check() && auth()->user()->currentTeam()) {
|
||||
$teamId = auth()->user()->currentTeam()->id;
|
||||
}
|
||||
$this->teamId = $teamId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
if (is_null($this->teamId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
new PrivateChannel("team.{$this->teamId}"),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -12,21 +12,22 @@ class ProxyStatusChanged implements ShouldBroadcast
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $teamId;
|
||||
public ?int $teamId = null;
|
||||
|
||||
public function __construct($teamId = null)
|
||||
{
|
||||
if (is_null($teamId)) {
|
||||
$teamId = auth()->user()->currentTeam()->id ?? null;
|
||||
}
|
||||
if (is_null($teamId)) {
|
||||
throw new \Exception('Team id is null');
|
||||
if (is_null($teamId) && auth()->check() && auth()->user()->currentTeam()) {
|
||||
$teamId = auth()->user()->currentTeam()->id;
|
||||
}
|
||||
$this->teamId = $teamId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
if (is_null($this->teamId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
new PrivateChannel("team.{$this->teamId}"),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -12,21 +12,22 @@ class ScheduledTaskDone implements ShouldBroadcast
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $teamId;
|
||||
public ?int $teamId = null;
|
||||
|
||||
public function __construct($teamId = null)
|
||||
{
|
||||
if (is_null($teamId)) {
|
||||
$teamId = auth()->user()->currentTeam()->id ?? null;
|
||||
}
|
||||
if (is_null($teamId)) {
|
||||
throw new \Exception('Team id is null');
|
||||
if (is_null($teamId) && auth()->check() && auth()->user()->currentTeam()) {
|
||||
$teamId = auth()->user()->currentTeam()->id;
|
||||
}
|
||||
$this->teamId = $teamId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
if (is_null($this->teamId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
new PrivateChannel("team.{$this->teamId}"),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -13,27 +13,24 @@ class ServiceStatusChanged implements ShouldBroadcast
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public ?string $userId = null;
|
||||
public int|string|null $userId = null;
|
||||
|
||||
public function __construct($userId = null)
|
||||
{
|
||||
if (is_null($userId)) {
|
||||
$userId = Auth::id() ?? null;
|
||||
}
|
||||
if (is_null($userId)) {
|
||||
return false;
|
||||
}
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): ?array
|
||||
{
|
||||
if (! is_null($this->userId)) {
|
||||
return [
|
||||
new PrivateChannel("user.{$this->userId}"),
|
||||
];
|
||||
if (is_null($this->userId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return null;
|
||||
return [
|
||||
new PrivateChannel("user.{$this->userId}"),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,21 @@ class TestEvent implements ShouldBroadcast
|
|||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $teamId;
|
||||
public ?int $teamId = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->teamId = auth()->user()->currentTeam()->id;
|
||||
if (auth()->check() && auth()->user()->currentTeam()) {
|
||||
$this->teamId = auth()->user()->currentTeam()->id;
|
||||
}
|
||||
}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
if (is_null($this->teamId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
new PrivateChannel("team.{$this->teamId}"),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -42,10 +42,8 @@ public function __construct(
|
|||
public function handle()
|
||||
{
|
||||
try {
|
||||
$persistentStorages = collect();
|
||||
switch ($this->resource->type()) {
|
||||
case 'application':
|
||||
$persistentStorages = $this->resource?->persistentStorages()?->get();
|
||||
StopApplication::run($this->resource, previewDeployments: true);
|
||||
break;
|
||||
case 'standalone-postgresql':
|
||||
|
|
@ -56,7 +54,6 @@ public function handle()
|
|||
case 'standalone-keydb':
|
||||
case 'standalone-dragonfly':
|
||||
case 'standalone-clickhouse':
|
||||
$persistentStorages = $this->resource?->persistentStorages()?->get();
|
||||
StopDatabase::run($this->resource, true);
|
||||
break;
|
||||
case 'service':
|
||||
|
|
@ -64,11 +61,6 @@ public function handle()
|
|||
DeleteService::run($this->resource, $this->deleteConfigurations, $this->deleteVolumes, $this->dockerCleanup, $this->deleteConnectedNetworks);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($this->deleteVolumes && $this->resource->type() !== 'service') {
|
||||
$this->resource->delete_volumes($persistentStorages);
|
||||
$this->resource->persistentStorages()->delete();
|
||||
}
|
||||
$isDatabase = $this->resource instanceof StandalonePostgresql
|
||||
|| $this->resource instanceof StandaloneRedis
|
||||
|| $this->resource instanceof StandaloneMongodb
|
||||
|
|
@ -79,29 +71,33 @@ public function handle()
|
|||
|| $this->resource instanceof StandaloneClickhouse;
|
||||
|
||||
if ($this->deleteConfigurations) {
|
||||
$this->resource->delete_configurations(); // rename to FileStorages
|
||||
$this->resource->fileStorages()->delete();
|
||||
$this->resource->deleteConfigurations();
|
||||
}
|
||||
if ($isDatabase) {
|
||||
$this->resource->sslCertificates()->delete();
|
||||
$this->resource->scheduledBackups()->delete();
|
||||
$this->resource->environment_variables()->delete();
|
||||
if ($this->resource->type() === 'service') {
|
||||
$this->resource->tags()->detach();
|
||||
} else {
|
||||
if ($this->deleteVolumes) {
|
||||
$this->resource->deleteVolumes();
|
||||
$this->resource->persistentStorages()->delete();
|
||||
}
|
||||
$this->resource->fileStorages()->delete();
|
||||
if ($isDatabase) {
|
||||
$this->resource->sslCertificates()->delete();
|
||||
$this->resource->scheduledBackups()->delete();
|
||||
$this->resource->tags()->detach();
|
||||
}
|
||||
}
|
||||
$this->resource->environment_variables()->delete();
|
||||
|
||||
$server = data_get($this->resource, 'server') ?? data_get($this->resource, 'destination.server');
|
||||
if (($this->dockerCleanup || $isDatabase) && $server) {
|
||||
CleanupDocker::dispatch($server, true);
|
||||
}
|
||||
|
||||
if ($this->deleteConnectedNetworks && ! $isDatabase) {
|
||||
$this->resource?->delete_connected_networks($this->resource->uuid);
|
||||
if ($this->deleteConnectedNetworks && ($this->resource->type() === 'service' || $this->resource->type() === 'application')) {
|
||||
$this->resource->deleteConnectedNetworks();
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
throw $e;
|
||||
} finally {
|
||||
$this->resource->forceDelete();
|
||||
if ($this->dockerCleanup) {
|
||||
$server = data_get($this->resource, 'server') ?? data_get($this->resource, 'destination.server');
|
||||
CleanupDocker::dispatch($server, true);
|
||||
}
|
||||
Artisan::queue('cleanup:stucked-resources');
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ public function stopContainers(array $containerNames, $server, int $timeout = 30
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -287,8 +287,9 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_volumes(?Collection $persistentStorages)
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($this->build_pack === 'dockercompose') {
|
||||
$server = data_get($this, 'destination.server');
|
||||
instant_remote_process(["cd {$this->dirOnServer()} && docker compose down -v"], $server, false);
|
||||
|
|
@ -303,8 +304,9 @@ public function delete_volumes(?Collection $persistentStorages)
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_connected_networks($uuid)
|
||||
public function deleteConnectedNetworks()
|
||||
{
|
||||
$uuid = $this->uuid;
|
||||
$server = data_get($this, 'destination.server');
|
||||
instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false);
|
||||
instant_remote_process(["docker network rm {$uuid}"], $server, false);
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public function stopContainers(array $containerNames, $server, int $timeout = 30
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -175,11 +175,11 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_connected_networks($uuid)
|
||||
public function deleteConnectedNetworks()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false);
|
||||
instant_remote_process(["docker network rm {$uuid}"], $server, false);
|
||||
instant_remote_process(["docker network disconnect {$this->uuid} coolify-proxy"], $server, false);
|
||||
instant_remote_process(["docker network rm {$this->uuid}"], $server, false);
|
||||
}
|
||||
|
||||
public function getStatusAttribute()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
|
@ -94,7 +93,7 @@ public function workdir()
|
|||
return database_configuration_dir()."/{$this->uuid}";
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -103,8 +102,9 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_volumes(Collection $persistentStorages)
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($persistentStorages->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
|
@ -94,7 +93,7 @@ public function workdir()
|
|||
return database_configuration_dir()."/{$this->uuid}";
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -103,8 +102,9 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_volumes(Collection $persistentStorages)
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($persistentStorages->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
|
@ -94,7 +93,7 @@ public function workdir()
|
|||
return database_configuration_dir()."/{$this->uuid}";
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -103,8 +102,9 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_volumes(Collection $persistentStorages)
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($persistentStorages->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
|
@ -94,7 +93,7 @@ public function workdir()
|
|||
return database_configuration_dir()."/{$this->uuid}";
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -103,8 +102,9 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_volumes(Collection $persistentStorages)
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($persistentStorages->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
|
@ -98,7 +97,7 @@ public function workdir()
|
|||
return database_configuration_dir()."/{$this->uuid}";
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -107,8 +106,9 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_volumes(Collection $persistentStorages)
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($persistentStorages->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
|
@ -95,7 +94,7 @@ public function workdir()
|
|||
return database_configuration_dir()."/{$this->uuid}";
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -104,8 +103,9 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_volumes(Collection $persistentStorages)
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($persistentStorages->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
|
@ -59,7 +58,7 @@ protected function serverStatus(): Attribute
|
|||
);
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -68,8 +67,9 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_volumes(Collection $persistentStorages)
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($persistentStorages->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
|
@ -96,7 +95,7 @@ public function workdir()
|
|||
return database_configuration_dir()."/{$this->uuid}";
|
||||
}
|
||||
|
||||
public function delete_configurations()
|
||||
public function deleteConfigurations()
|
||||
{
|
||||
$server = data_get($this, 'destination.server');
|
||||
$workdir = $this->workdir();
|
||||
|
|
@ -105,8 +104,9 @@ public function delete_configurations()
|
|||
}
|
||||
}
|
||||
|
||||
public function delete_volumes(Collection $persistentStorages)
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($persistentStorages->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue