mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
refactoring - remove unused code
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user