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