refactoring - remove unused code

This commit is contained in:
Saeed Vaziry
2024-03-06 20:33:33 +01:00
parent cfc0645002
commit 9d705592da
32 changed files with 3 additions and 442 deletions

View File

@ -7,7 +7,6 @@
use App\Contracts\ProcessManager;
use App\Contracts\Webserver;
use App\Enums\ServiceStatus;
use App\Events\Broadcast;
use App\Exceptions\InstallationFailed;
use App\Jobs\Service\Manage;
use App\ServiceHandlers\PHP;
@ -96,20 +95,7 @@ public function install(): void
{
Bus::chain([
$this->installer(),
function () {
event(
new Broadcast('install-service-finished', [
'service' => $this,
])
);
},
])->catch(function () {
event(
new Broadcast('install-service-failed', [
'service' => $this,
])
);
})->onConnection('ssh-long')->dispatch();
])->onConnection('ssh-long')->dispatch();
}
/**
@ -117,18 +103,7 @@ function () {
*/
public function validateInstall($result): void
{
if (Str::contains($result, 'Active: active')) {
event(
new Broadcast('install-service-finished', [
'service' => $this,
])
);
} else {
event(
new Broadcast('install-service-failed', [
'service' => $this,
])
);
if (! Str::contains($result, 'Active: active')) {
throw new InstallationFailed();
}
}
@ -140,21 +115,11 @@ public function uninstall(): void
Bus::chain([
$this->uninstaller(),
function () {
event(
new Broadcast('uninstall-service-finished', [
'service' => $this,
])
);
$this->delete();
},
])->catch(function () {
$this->status = ServiceStatus::FAILED;
$this->save();
event(
new Broadcast('uninstall-service-failed', [
'service' => $this,
])
);
})->onConnection('ssh')->dispatch();
}

View File

@ -6,7 +6,6 @@
use App\Enums\DeploymentStatus;
use App\Enums\SiteStatus;
use App\Enums\SslStatus;
use App\Events\Broadcast;
use App\Exceptions\SourceControlIsNotConnected;
use App\Facades\Notifier;
use App\Jobs\Site\Deploy;
@ -399,11 +398,6 @@ public function installationFinished(): void
'status' => SiteStatus::READY,
'progress' => 100,
]);
event(
new Broadcast('install-site-finished', [
'site' => $this,
])
);
Notifier::send($this, new SiteInstallationSucceed($this));
}
@ -415,11 +409,6 @@ public function installationFailed(Throwable $e): void
$this->update([
'status' => SiteStatus::INSTALLATION_FAILED,
]);
event(
new Broadcast('install-site-failed', [
'site' => $this,
])
);
Notifier::send($this, new SiteInstallationFailed($this));
Log::error('install-site-error', [
'error' => (string) $e,