From 6bc55b1039ed323b3a7de944f51fcf5f87c32c9e Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Sat, 15 Mar 2025 19:28:59 +0100 Subject: [PATCH] Silent `file_exists` when its not in defaults allowed `open_basedir` (#1086) --- .../Commands/Environment/QueueWorkerServiceCommand.php | 2 +- app/Livewire/Installer/Steps/QueueStep.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php index dbf1aa735..92ea88e75 100644 --- a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php +++ b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php @@ -21,7 +21,7 @@ class QueueWorkerServiceCommand extends Command $serviceName = $this->option('service-name') ?? $this->ask('Queue worker service name', 'pelican-queue'); $path = '/etc/systemd/system/' . $serviceName . '.service'; - $fileExists = file_exists($path); + $fileExists = @file_exists($path); if ($fileExists && !$this->option('overwrite') && !$this->confirm('The service file already exists. Do you want to overwrite it?')) { $this->line('Creation of queue worker service file aborted because service file already exists.'); diff --git a/app/Livewire/Installer/Steps/QueueStep.php b/app/Livewire/Installer/Steps/QueueStep.php index ee2309a78..b800e68ab 100644 --- a/app/Livewire/Installer/Steps/QueueStep.php +++ b/app/Livewire/Installer/Steps/QueueStep.php @@ -36,25 +36,25 @@ class QueueStep ->default(config('queue.default')), Toggle::make('done') ->label('I have done both steps below.') - ->accepted(fn () => !file_exists('/.dockerenv')) + ->accepted(fn () => !@file_exists('/.dockerenv')) ->inline(false) ->validationMessages([ 'accepted' => 'You need to do both steps before continuing!', ]) - ->hidden(fn () => file_exists('/.dockerenv')), + ->hidden(fn () => @file_exists('/.dockerenv')), TextInput::make('crontab') ->label(new HtmlString('Run the following command to set up your crontab. Note that www-data is your webserver user. On some systems this username might be different!')) ->disabled() ->hintAction(fn () => request()->isSecure() ? CopyAction::make() : null) ->default('(crontab -l -u www-data 2>/dev/null; echo "* * * * * php ' . base_path() . '/artisan schedule:run >> /dev/null 2>&1") | crontab -u www-data -') - ->hidden(fn () => file_exists('/.dockerenv')) + ->hidden(fn () => @file_exists('/.dockerenv')) ->columnSpanFull(), TextInput::make('queueService') ->label(new HtmlString('To setup the queue worker service you simply have to run the following command.')) ->disabled() ->hintAction(fn () => request()->isSecure() ? CopyAction::make() : null) ->default('sudo php ' . base_path() . '/artisan p:environment:queue-service') - ->hidden(fn () => file_exists('/.dockerenv')) + ->hidden(fn () => @file_exists('/.dockerenv')) ->columnSpanFull(), ]) ->afterValidation(fn () => $installer->writeToEnv('env_queue'));