Always prefer stricter string comparisons.
This commit is contained in:
@@ -76,14 +76,14 @@ class ScheduledTaskJob implements ShouldQueue
|
|||||||
|
|
||||||
$this->server = $this->resource->destination->server;
|
$this->server = $this->resource->destination->server;
|
||||||
|
|
||||||
if ($this->resource->type() == 'application') {
|
if ($this->resource->type() === 'application') {
|
||||||
$containers = getCurrentApplicationContainerStatus($this->server, $this->resource->id, 0);
|
$containers = getCurrentApplicationContainerStatus($this->server, $this->resource->id, 0);
|
||||||
if ($containers->count() > 0) {
|
if ($containers->count() > 0) {
|
||||||
$containers->each(function ($container) {
|
$containers->each(function ($container) {
|
||||||
$this->containers[] = str_replace('/', '', $container['Names']);
|
$this->containers[] = str_replace('/', '', $container['Names']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} elseif ($this->resource->type() == 'service') {
|
} elseif ($this->resource->type() === 'service') {
|
||||||
$this->resource->applications()->get()->each(function ($application) {
|
$this->resource->applications()->get()->each(function ($application) {
|
||||||
if (str(data_get($application, 'status'))->contains('running')) {
|
if (str(data_get($application, 'status'))->contains('running')) {
|
||||||
$this->containers[] = data_get($application, 'name').'-'.data_get($this->resource, 'uuid');
|
$this->containers[] = data_get($application, 'name').'-'.data_get($this->resource, 'uuid');
|
||||||
|
@@ -64,7 +64,7 @@ class Show extends Component
|
|||||||
{
|
{
|
||||||
$this->dispatch('deploymentFinished');
|
$this->dispatch('deploymentFinished');
|
||||||
$this->application_deployment_queue->refresh();
|
$this->application_deployment_queue->refresh();
|
||||||
if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') {
|
if (data_get($this->application_deployment_queue, 'status') === 'finished' || data_get($this->application_deployment_queue, 'status') === 'failed') {
|
||||||
$this->isKeepAliveOn = false;
|
$this->isKeepAliveOn = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -121,7 +121,7 @@ class BackupEdit extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->custom_validate();
|
$this->custom_validate();
|
||||||
if ($this->backup->databases_to_backup == '' || $this->backup->databases_to_backup === null) {
|
if ($this->backup->databases_to_backup === '' || $this->backup->databases_to_backup === null) {
|
||||||
$this->backup->databases_to_backup = null;
|
$this->backup->databases_to_backup = null;
|
||||||
}
|
}
|
||||||
$this->backup->save();
|
$this->backup->save();
|
||||||
|
@@ -77,10 +77,10 @@ class Import extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$this->resource->getMorphClass() == \App\Models\StandaloneRedis::class ||
|
$this->resource->getMorphClass() === \App\Models\StandaloneRedis::class ||
|
||||||
$this->resource->getMorphClass() == \App\Models\StandaloneKeydb::class ||
|
$this->resource->getMorphClass() === \App\Models\StandaloneKeydb::class ||
|
||||||
$this->resource->getMorphClass() == \App\Models\StandaloneDragonfly::class ||
|
$this->resource->getMorphClass() === \App\Models\StandaloneDragonfly::class ||
|
||||||
$this->resource->getMorphClass() == \App\Models\StandaloneClickhouse::class
|
$this->resource->getMorphClass() === \App\Models\StandaloneClickhouse::class
|
||||||
) {
|
) {
|
||||||
$this->unsupported = true;
|
$this->unsupported = true;
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ class Import extends Component
|
|||||||
public function runImport()
|
public function runImport()
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->filename == '') {
|
if ($this->filename === '') {
|
||||||
$this->dispatch('error', 'Please select a file to import.');
|
$this->dispatch('error', 'Please select a file to import.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -198,7 +198,7 @@ class GithubPrivateRepositoryDeployKey extends Component
|
|||||||
$this->git_host = $this->repository_url_parsed->getHost();
|
$this->git_host = $this->repository_url_parsed->getHost();
|
||||||
$this->git_repository = $this->repository_url_parsed->getSegment(1).'/'.$this->repository_url_parsed->getSegment(2);
|
$this->git_repository = $this->repository_url_parsed->getSegment(1).'/'.$this->repository_url_parsed->getSegment(2);
|
||||||
|
|
||||||
if ($this->git_host == 'github.com') {
|
if ($this->git_host === 'github.com') {
|
||||||
$this->git_source = GithubApp::where('name', 'Public GitHub')->first();
|
$this->git_source = GithubApp::where('name', 'Public GitHub')->first();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -174,7 +174,7 @@ class PublicGitRepository extends Component
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (! $this->branchFound && $this->git_branch == 'main') {
|
if (! $this->branchFound && $this->git_branch === 'main') {
|
||||||
try {
|
try {
|
||||||
$this->git_branch = 'master';
|
$this->git_branch = 'master';
|
||||||
$this->getBranch();
|
$this->getBranch();
|
||||||
@@ -197,7 +197,7 @@ class PublicGitRepository extends Component
|
|||||||
} else {
|
} else {
|
||||||
$this->git_branch = 'main';
|
$this->git_branch = 'main';
|
||||||
}
|
}
|
||||||
if ($this->git_host == 'github.com') {
|
if ($this->git_host === 'github.com') {
|
||||||
$this->git_source = GithubApp::where('name', 'Public GitHub')->first();
|
$this->git_source = GithubApp::where('name', 'Public GitHub')->first();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -55,8 +55,8 @@ class Add extends Component
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (empty($this->container) || $this->container == 'null') {
|
if (empty($this->container) || $this->container === 'null') {
|
||||||
if ($this->type == 'service') {
|
if ($this->type === 'service') {
|
||||||
$this->container = $this->subServiceName;
|
$this->container = $this->subServiceName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,10 +21,10 @@ class All extends Component
|
|||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$this->parameters = get_route_parameters();
|
$this->parameters = get_route_parameters();
|
||||||
if ($this->resource->type() == 'service') {
|
if ($this->resource->type() === 'service') {
|
||||||
$this->containerNames = $this->resource->applications()->pluck('name');
|
$this->containerNames = $this->resource->applications()->pluck('name');
|
||||||
$this->containerNames = $this->containerNames->merge($this->resource->databases()->pluck('name'));
|
$this->containerNames = $this->containerNames->merge($this->resource->databases()->pluck('name'));
|
||||||
} elseif ($this->resource->type() == 'application') {
|
} elseif ($this->resource->type() === 'application') {
|
||||||
if ($this->resource->build_pack === 'dockercompose') {
|
if ($this->resource->build_pack === 'dockercompose') {
|
||||||
$parsed = $this->resource->parse();
|
$parsed = $this->resource->parse();
|
||||||
$containers = collect(data_get($parsed, 'services'))->keys();
|
$containers = collect(data_get($parsed, 'services'))->keys();
|
||||||
|
@@ -77,7 +77,7 @@ class Show extends Component
|
|||||||
try {
|
try {
|
||||||
$this->task->delete();
|
$this->task->delete();
|
||||||
|
|
||||||
if ($this->type == 'application') {
|
if ($this->type === 'application') {
|
||||||
return redirect()->route('project.application.configuration', $this->parameters, $this->scheduledTaskName);
|
return redirect()->route('project.application.configuration', $this->parameters, $this->scheduledTaskName);
|
||||||
} else {
|
} else {
|
||||||
return redirect()->route('project.service.configuration', $this->parameters, $this->scheduledTaskName);
|
return redirect()->route('project.service.configuration', $this->parameters, $this->scheduledTaskName);
|
||||||
|
@@ -47,7 +47,7 @@ class Index extends Component
|
|||||||
|
|
||||||
public function tagUpdated()
|
public function tagUpdated()
|
||||||
{
|
{
|
||||||
if ($this->tag == '') {
|
if ($this->tag === '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$sanitizedTag = htmlspecialchars($this->tag, ENT_QUOTES, 'UTF-8');
|
$sanitizedTag = htmlspecialchars($this->tag, ENT_QUOTES, 'UTF-8');
|
||||||
|
@@ -114,7 +114,7 @@ class Application extends BaseModel
|
|||||||
protected static function booted()
|
protected static function booted()
|
||||||
{
|
{
|
||||||
static::saving(function ($application) {
|
static::saving(function ($application) {
|
||||||
if ($application->fqdn == '') {
|
if ($application->fqdn === '') {
|
||||||
$application->fqdn = null;
|
$application->fqdn = null;
|
||||||
}
|
}
|
||||||
$application->forceFill([
|
$application->forceFill([
|
||||||
@@ -936,7 +936,7 @@ class Application extends BaseModel
|
|||||||
$source_html_url_host = $url['host'];
|
$source_html_url_host = $url['host'];
|
||||||
$source_html_url_scheme = $url['scheme'];
|
$source_html_url_scheme = $url['scheme'];
|
||||||
|
|
||||||
if ($this->source->getMorphClass() == \App\Models\GithubApp::class) {
|
if ($this->source->getMorphClass() === \App\Models\GithubApp::class) {
|
||||||
if ($this->source->is_public) {
|
if ($this->source->is_public) {
|
||||||
$fullRepoUrl = "{$this->source->html_url}/{$customRepository}";
|
$fullRepoUrl = "{$this->source->html_url}/{$customRepository}";
|
||||||
$git_clone_command = "{$git_clone_command} {$this->source->html_url}/{$customRepository} {$baseDir}";
|
$git_clone_command = "{$git_clone_command} {$this->source->html_url}/{$customRepository} {$baseDir}";
|
||||||
@@ -1407,7 +1407,7 @@ class Application extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -1431,7 +1431,7 @@ class Application extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -156,7 +156,7 @@ class EnvironmentVariable extends Model
|
|||||||
|
|
||||||
private function get_real_environment_variables(?string $environment_variable = null, $resource = null)
|
private function get_real_environment_variables(?string $environment_variable = null, $resource = null)
|
||||||
{
|
{
|
||||||
if ((is_null($environment_variable) && $environment_variable == '') || is_null($resource)) {
|
if ((is_null($environment_variable) && $environment_variable === '') || is_null($resource)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$environment_variable = trim($environment_variable);
|
$environment_variable = trim($environment_variable);
|
||||||
@@ -202,7 +202,7 @@ class EnvironmentVariable extends Model
|
|||||||
|
|
||||||
private function set_environment_variables(?string $environment_variable = null): ?string
|
private function set_environment_variables(?string $environment_variable = null): ?string
|
||||||
{
|
{
|
||||||
if (is_null($environment_variable) && $environment_variable == '') {
|
if (is_null($environment_variable) && $environment_variable === '') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$environment_variable = trim($environment_variable);
|
$environment_variable = trim($environment_variable);
|
||||||
|
@@ -113,15 +113,15 @@ class LocalFileVolume extends BaseModel
|
|||||||
}
|
}
|
||||||
$isFile = instant_remote_process(["test -f $path && echo OK || echo NOK"], $server);
|
$isFile = instant_remote_process(["test -f $path && echo OK || echo NOK"], $server);
|
||||||
$isDir = instant_remote_process(["test -d $path && echo OK || echo NOK"], $server);
|
$isDir = instant_remote_process(["test -d $path && echo OK || echo NOK"], $server);
|
||||||
if ($isFile == 'OK' && $this->is_directory) {
|
if ($isFile === 'OK' && $this->is_directory) {
|
||||||
$content = instant_remote_process(["cat $path"], $server, false);
|
$content = instant_remote_process(["cat $path"], $server, false);
|
||||||
$this->is_directory = false;
|
$this->is_directory = false;
|
||||||
$this->content = $content;
|
$this->content = $content;
|
||||||
$this->save();
|
$this->save();
|
||||||
FileStorageChanged::dispatch(data_get($server, 'team_id'));
|
FileStorageChanged::dispatch(data_get($server, 'team_id'));
|
||||||
throw new \Exception('The following file is a file on the server, but you are trying to mark it as a directory. Please delete the file on the server or mark it as directory.');
|
throw new \Exception('The following file is a file on the server, but you are trying to mark it as a directory. Please delete the file on the server or mark it as directory.');
|
||||||
} elseif ($isDir == 'OK' && ! $this->is_directory) {
|
} elseif ($isDir === 'OK' && ! $this->is_directory) {
|
||||||
if ($path == '/' || $path == '.' || $path == '..' || $path == '' || str($path)->isEmpty() || is_null($path)) {
|
if ($path === '/' || $path === '.' || $path === '..' || $path === '' || str($path)->isEmpty() || is_null($path)) {
|
||||||
$this->is_directory = true;
|
$this->is_directory = true;
|
||||||
$this->save();
|
$this->save();
|
||||||
throw new \Exception('The following file is a directory on the server, but you are trying to mark it as a file. <br><br>Please delete the directory on the server or mark it as directory.');
|
throw new \Exception('The following file is a directory on the server, but you are trying to mark it as a file. <br><br>Please delete the directory on the server or mark it as directory.');
|
||||||
@@ -132,7 +132,7 @@ class LocalFileVolume extends BaseModel
|
|||||||
], $server, false);
|
], $server, false);
|
||||||
FileStorageChanged::dispatch(data_get($server, 'team_id'));
|
FileStorageChanged::dispatch(data_get($server, 'team_id'));
|
||||||
}
|
}
|
||||||
if ($isDir == 'NOK' && ! $this->is_directory) {
|
if ($isDir === 'NOK' && ! $this->is_directory) {
|
||||||
$chmod = data_get($this, 'chmod');
|
$chmod = data_get($this, 'chmod');
|
||||||
$chown = data_get($this, 'chown');
|
$chown = data_get($this, 'chown');
|
||||||
if ($content) {
|
if ($content) {
|
||||||
@@ -148,7 +148,7 @@ class LocalFileVolume extends BaseModel
|
|||||||
if ($chmod) {
|
if ($chmod) {
|
||||||
$commands->push("chmod $chmod $path");
|
$commands->push("chmod $chmod $path");
|
||||||
}
|
}
|
||||||
} elseif ($isDir == 'NOK' && $this->is_directory) {
|
} elseif ($isDir === 'NOK' && $this->is_directory) {
|
||||||
$commands->push("mkdir -p $path > /dev/null 2>&1 || true");
|
$commands->push("mkdir -p $path > /dev/null 2>&1 || true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -421,7 +421,7 @@ respond 404
|
|||||||
"echo '$base64' | base64 -d | tee $file > /dev/null",
|
"echo '$base64' | base64 -d | tee $file > /dev/null",
|
||||||
], $this);
|
], $this);
|
||||||
|
|
||||||
if (config('app.env') == 'local') {
|
if (config('app.env') === 'local') {
|
||||||
// ray($yaml);
|
// ray($yaml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -597,7 +597,7 @@ $schema://$host {
|
|||||||
if (str($cpu)->contains('error')) {
|
if (str($cpu)->contains('error')) {
|
||||||
$error = json_decode($cpu, true);
|
$error = json_decode($cpu, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -619,7 +619,7 @@ $schema://$host {
|
|||||||
if (str($memory)->contains('error')) {
|
if (str($memory)->contains('error')) {
|
||||||
$error = json_decode($memory, true);
|
$error = json_decode($memory, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -275,7 +275,7 @@ class StandaloneClickhouse extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -297,7 +297,7 @@ class StandaloneClickhouse extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -275,7 +275,7 @@ class StandaloneDragonfly extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -297,7 +297,7 @@ class StandaloneDragonfly extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -275,7 +275,7 @@ class StandaloneKeydb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -297,7 +297,7 @@ class StandaloneKeydb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -275,7 +275,7 @@ class StandaloneMariadb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -297,7 +297,7 @@ class StandaloneMariadb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -295,7 +295,7 @@ class StandaloneMongodb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -317,7 +317,7 @@ class StandaloneMongodb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -276,7 +276,7 @@ class StandaloneMysql extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -298,7 +298,7 @@ class StandaloneMysql extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -281,7 +281,7 @@ class StandalonePostgresql extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -303,7 +303,7 @@ class StandalonePostgresql extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -286,7 +286,7 @@ class StandaloneRedis extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -308,7 +308,7 @@ class StandaloneRedis extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
@@ -57,7 +57,7 @@ function githubApi(GithubApp|GitlabApp|null $source, string $endpoint, string $m
|
|||||||
if (is_null($source)) {
|
if (is_null($source)) {
|
||||||
throw new \Exception('Not implemented yet.');
|
throw new \Exception('Not implemented yet.');
|
||||||
}
|
}
|
||||||
if ($source->getMorphClass() == \App\Models\GithubApp::class) {
|
if ($source->getMorphClass() === \App\Models\GithubApp::class) {
|
||||||
if ($source->is_public) {
|
if ($source->is_public) {
|
||||||
$response = Http::github($source->api_url)->$method($endpoint);
|
$response = Http::github($source->api_url)->$method($endpoint);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -51,7 +51,7 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli
|
|||||||
// Exists and is a directory
|
// Exists and is a directory
|
||||||
$isDir = instant_remote_process(["test -d $fileLocation && echo OK || echo NOK"], $server);
|
$isDir = instant_remote_process(["test -d $fileLocation && echo OK || echo NOK"], $server);
|
||||||
|
|
||||||
if ($isFile == 'OK') {
|
if ($isFile === 'OK') {
|
||||||
// If its a file & exists
|
// If its a file & exists
|
||||||
$filesystemContent = instant_remote_process(["cat $fileLocation"], $server);
|
$filesystemContent = instant_remote_process(["cat $fileLocation"], $server);
|
||||||
if ($fileVolume->is_based_on_git) {
|
if ($fileVolume->is_based_on_git) {
|
||||||
@@ -59,12 +59,12 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli
|
|||||||
}
|
}
|
||||||
$fileVolume->is_directory = false;
|
$fileVolume->is_directory = false;
|
||||||
$fileVolume->save();
|
$fileVolume->save();
|
||||||
} elseif ($isDir == 'OK') {
|
} elseif ($isDir === 'OK') {
|
||||||
// If its a directory & exists
|
// If its a directory & exists
|
||||||
$fileVolume->content = null;
|
$fileVolume->content = null;
|
||||||
$fileVolume->is_directory = true;
|
$fileVolume->is_directory = true;
|
||||||
$fileVolume->save();
|
$fileVolume->save();
|
||||||
} elseif ($isFile == 'NOK' && $isDir == 'NOK' && ! $fileVolume->is_directory && $isInit && $content) {
|
} elseif ($isFile === 'NOK' && $isDir === 'NOK' && ! $fileVolume->is_directory && $isInit && $content) {
|
||||||
// Does not exists (no dir or file), not flagged as directory, is init, has content
|
// Does not exists (no dir or file), not flagged as directory, is init, has content
|
||||||
$fileVolume->content = $content;
|
$fileVolume->content = $content;
|
||||||
$fileVolume->is_directory = false;
|
$fileVolume->is_directory = false;
|
||||||
@@ -75,13 +75,13 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli
|
|||||||
"mkdir -p $dir",
|
"mkdir -p $dir",
|
||||||
"echo '$content' | base64 -d | tee $fileLocation",
|
"echo '$content' | base64 -d | tee $fileLocation",
|
||||||
], $server);
|
], $server);
|
||||||
} elseif ($isFile == 'NOK' && $isDir == 'NOK' && $fileVolume->is_directory && $isInit) {
|
} elseif ($isFile === 'NOK' && $isDir === 'NOK' && $fileVolume->is_directory && $isInit) {
|
||||||
// Does not exists (no dir or file), flagged as directory, is init
|
// Does not exists (no dir or file), flagged as directory, is init
|
||||||
$fileVolume->content = null;
|
$fileVolume->content = null;
|
||||||
$fileVolume->is_directory = true;
|
$fileVolume->is_directory = true;
|
||||||
$fileVolume->save();
|
$fileVolume->save();
|
||||||
instant_remote_process(["mkdir -p $fileLocation"], $server);
|
instant_remote_process(["mkdir -p $fileLocation"], $server);
|
||||||
} elseif ($isFile == 'NOK' && $isDir == 'NOK' && ! $fileVolume->is_directory && $isInit && is_null($content)) {
|
} elseif ($isFile === 'NOK' && $isDir === 'NOK' && ! $fileVolume->is_directory && $isInit && is_null($content)) {
|
||||||
// Does not exists (no dir or file), not flagged as directory, is init, has no content => create directory
|
// Does not exists (no dir or file), not flagged as directory, is init, has no content => create directory
|
||||||
$fileVolume->content = null;
|
$fileVolume->content = null;
|
||||||
$fileVolume->is_directory = true;
|
$fileVolume->is_directory = true;
|
||||||
|
@@ -7,7 +7,7 @@ function get_socialite_provider(string $provider)
|
|||||||
{
|
{
|
||||||
$oauth_setting = OauthSetting::firstWhere('provider', $provider);
|
$oauth_setting = OauthSetting::firstWhere('provider', $provider);
|
||||||
|
|
||||||
if ($provider == 'azure') {
|
if ($provider === 'azure') {
|
||||||
$azure_config = new \SocialiteProviders\Manager\Config(
|
$azure_config = new \SocialiteProviders\Manager\Config(
|
||||||
$oauth_setting->client_id,
|
$oauth_setting->client_id,
|
||||||
$oauth_setting->client_secret,
|
$oauth_setting->client_secret,
|
||||||
|
Reference in New Issue
Block a user