rector: arrrrr

This commit is contained in:
Andras Bacsai
2025-01-07 14:52:08 +01:00
parent c702ebff6d
commit 16c0cd10d8
349 changed files with 4204 additions and 3712 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Events;
use Exception;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
@@ -20,7 +21,7 @@ class ApplicationStatusChanged implements ShouldBroadcast
$teamId = auth()->user()->currentTeam()->id ?? null;
}
if (is_null($teamId)) {
throw new \Exception('Team id is null');
throw new Exception('Team id is null');
}
$this->teamId = $teamId;
}

View File

@@ -2,6 +2,7 @@
namespace App\Events;
use Exception;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
@@ -20,7 +21,7 @@ class BackupCreated implements ShouldBroadcast
$teamId = auth()->user()->currentTeam()->id ?? null;
}
if (is_null($teamId)) {
throw new \Exception('Team id is null');
throw new Exception('Team id is null');
}
$this->teamId = $teamId;
}

View File

@@ -2,6 +2,7 @@
namespace App\Events;
use Exception;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
@@ -20,7 +21,7 @@ class CloudflareTunnelConfigured implements ShouldBroadcast
$teamId = auth()->user()->currentTeam()->id ?? null;
}
if (is_null($teamId)) {
throw new \Exception('Team id is null');
throw new Exception('Team id is null');
}
$this->teamId = $teamId;
}

View File

@@ -2,6 +2,7 @@
namespace App\Events;
use Exception;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
@@ -21,7 +22,7 @@ class DatabaseProxyStopped implements ShouldBroadcast
$teamId = Auth::user()?->currentTeam()?->id ?? null;
}
if (is_null($teamId)) {
throw new \Exception('Team id is null');
throw new Exception('Team id is null');
}
$this->teamId = $teamId;
}

View File

@@ -13,7 +13,7 @@ class DatabaseStatusChanged implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $userId = null;
public $userId;
public function __construct($userId = null)
{
@@ -21,7 +21,7 @@ class DatabaseStatusChanged implements ShouldBroadcast
$userId = Auth::id() ?? null;
}
if (is_null($userId)) {
return false;
return;
}
$this->userId = $userId;

View File

@@ -2,6 +2,7 @@
namespace App\Events;
use Exception;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
@@ -17,7 +18,7 @@ class FileStorageChanged implements ShouldBroadcast
public function __construct($teamId = null)
{
if (is_null($teamId)) {
throw new \Exception('Team id is null');
throw new Exception('Team id is null');
}
$this->teamId = $teamId;
}

View File

@@ -2,6 +2,7 @@
namespace App\Events;
use Exception;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
@@ -20,7 +21,7 @@ class ProxyStatusChanged implements ShouldBroadcast
$teamId = auth()->user()->currentTeam()->id ?? null;
}
if (is_null($teamId)) {
throw new \Exception('Team id is null');
throw new Exception('Team id is null');
}
$this->teamId = $teamId;
}

View File

@@ -17,18 +17,15 @@ class RestoreJobFinished
$tmpPath = data_get($data, 'tmpPath');
$container = data_get($data, 'container');
$serverId = data_get($data, 'serverId');
if (filled($scriptPath) && filled($tmpPath) && filled($container) && filled($serverId)) {
if (str($tmpPath)->startsWith('/tmp/')
&& str($scriptPath)->startsWith('/tmp/')
&& ! str($tmpPath)->contains('..')
&& ! str($scriptPath)->contains('..')
&& strlen($tmpPath) > 5 // longer than just "/tmp/"
&& strlen($scriptPath) > 5
) {
$commands[] = "docker exec {$container} sh -c 'rm {$scriptPath}'";
$commands[] = "docker exec {$container} sh -c 'rm {$tmpPath}'";
instant_remote_process($commands, Server::find($serverId), throwError: true);
}
if (filled($scriptPath) && filled($tmpPath) && filled($container) && filled($serverId) && (str($tmpPath)->startsWith('/tmp/')
&& str($scriptPath)->startsWith('/tmp/')
&& ! str($tmpPath)->contains('..')
&& ! str($scriptPath)->contains('..')
&& strlen($tmpPath) > 5 // longer than just "/tmp/"
&& strlen($scriptPath) > 5)) {
$commands[] = "docker exec {$container} sh -c 'rm {$scriptPath}'";
$commands[] = "docker exec {$container} sh -c 'rm {$tmpPath}'";
instant_remote_process($commands, Server::query()->find($serverId), throwError: true);
}
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Events;
use Exception;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
@@ -20,7 +21,7 @@ class ScheduledTaskDone implements ShouldBroadcast
$teamId = auth()->user()->currentTeam()->id ?? null;
}
if (is_null($teamId)) {
throw new \Exception('Team id is null');
throw new Exception('Team id is null');
}
$this->teamId = $teamId;
}

View File

@@ -21,7 +21,7 @@ class ServiceStatusChanged implements ShouldBroadcast
$userId = Auth::id() ?? null;
}
if (is_null($userId)) {
return false;
return;
}
$this->userId = $userId;
}