Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor: Remove unnecessary debug statements and improve code structure in RunRemoteProcess.php and ApplicationDeploymentJob.php

Andras Bacsai07e801f44db1
diff --git a/app/Actions/CoolifyTask/RunRemoteProcess.php b/app/Actions/CoolifyTask/RunRemoteProcess.php
index d464974504..16924476bf 100644
--- a/app/Actions/CoolifyTask/RunRemoteProcess.php
+++ b/app/Actions/CoolifyTask/RunRemoteProcess.php
@@ -5,7 +5,6 @@ namespace App\Actions\CoolifyTask;
use App\Enums\ActivityTypes;
use App\Enums\ProcessStatus;
use App\Jobs\ApplicationDeploymentJob;
-use App\Jobs\ApplicationDeploymentJobNew;
use App\Models\Server;
use Illuminate\Process\ProcessResult;
use Illuminate\Support\Facades\DB;
@@ -166,23 +165,13 @@ class RunRemoteProcess
public function encodeOutput($type, $output)
{
$outputStack = json_decode($this->activity->description, associative: true, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
- if (isDev()) {
- $outputStack[] = [
- 'type' => $type,
- 'output' => $output,
- 'timestamp' => hrtime(true),
- 'batch' => ApplicationDeploymentJobNew::$batch_counter,
- 'order' => $this->getLatestCounter(),
- ];
- } else {
- $outputStack[] = [
- 'type' => $type,
- 'output' => $output,
- 'timestamp' => hrtime(true),
- 'batch' => ApplicationDeploymentJob::$batch_counter,
- 'order' => $this->getLatestCounter(),
- ];
- }
+ $outputStack[] = [
+ 'type' => $type,
+ 'output' => $output,
+ 'timestamp' => hrtime(true),
+ 'batch' => ApplicationDeploymentJob::$batch_counter,
+ 'order' => $this->getLatestCounter(),
+ ];
return json_encode($outputStack, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
}
diff --git a/bootstrap/helpers/applications.php b/bootstrap/helpers/applications.php
index 23558cd878..39d21bccad 100644
--- a/bootstrap/helpers/applications.php
+++ b/bootstrap/helpers/applications.php
@@ -2,7 +2,6 @@
use App\Enums\ApplicationDeploymentStatus;
use App\Jobs\ApplicationDeploymentJob;
-use App\Jobs\ApplicationDeploymentJobNew;
use App\Models\Application;
use App\Models\ApplicationDeploymentQueue;
use App\Models\Server;
@@ -43,26 +42,14 @@ function queue_application_deployment(Application $application, string $deployme
'only_this_server' => $only_this_server
]);
- if (isDev()) {
- if ($no_questions_asked) {
- dispatch(new ApplicationDeploymentJobNew(
- application_deployment_queue_id: $deployment->id,
- ));
- } else if (next_queuable($server_id, $application_id)) {
- dispatch(new ApplicationDeploymentJobNew(
- application_deployment_queue_id: $deployment->id,
- ));
- }
- } else {
- if ($no_questions_asked) {
- dispatch(new ApplicationDeploymentJob(
- application_deployment_queue_id: $deployment->id,
- ));
- } else if (next_queuable($server_id, $application_id)) {
- dispatch(new ApplicationDeploymentJob(
- application_deployment_queue_id: $deployment->id,
- ));
- }
+ if ($no_questions_asked) {
+ dispatch(new ApplicationDeploymentJob(
+ application_deployment_queue_id: $deployment->id,
+ ));
+ } else if (next_queuable($server_id, $application_id)) {
+ dispatch(new ApplicationDeploymentJob(
+ application_deployment_queue_id: $deployment->id,
+ ));
}
}
function force_start_deployment(ApplicationDeploymentQueue $deployment)
@@ -70,15 +57,10 @@ function force_start_deployment(ApplicationDeploymentQueue $deployment)
$deployment->update([
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
]);
- if (isDev()) {
- dispatch(new ApplicationDeploymentJobNew(
- application_deployment_queue_id: $deployment->id,
- ));
- } else {
- dispatch(new ApplicationDeploymentJob(
- application_deployment_queue_id: $deployment->id,
- ));
- }
+
+ dispatch(new ApplicationDeploymentJob(
+ application_deployment_queue_id: $deployment->id,
+ ));
}
function queue_next_deployment(Application $application)
{
@@ -88,15 +70,10 @@ function queue_next_deployment(Application $application)
$next_found->update([
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
]);
- if (isDev()) {
- dispatch(new ApplicationDeploymentJobNew(
- application_deployment_queue_id: $next_found->id,
- ));
- } else {
- dispatch(new ApplicationDeploymentJob(
- application_deployment_queue_id: $next_found->id,
- ));
- }
+
+ dispatch(new ApplicationDeploymentJob(
+ application_deployment_queue_id: $next_found->id,
+ ));
}
}