Silent file_exists when its not in defaults allowed open_basedir (#1086)

This commit is contained in:
MartinOscar 2025-03-15 19:28:59 +01:00 committed by GitHub
parent 11b153d23c
commit 6bc55b1039
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,7 @@ class QueueWorkerServiceCommand extends Command
$serviceName = $this->option('service-name') ?? $this->ask('Queue worker service name', 'pelican-queue'); $serviceName = $this->option('service-name') ?? $this->ask('Queue worker service name', 'pelican-queue');
$path = '/etc/systemd/system/' . $serviceName . '.service'; $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?')) { 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.'); $this->line('Creation of queue worker service file aborted because service file already exists.');

View File

@ -36,25 +36,25 @@ class QueueStep
->default(config('queue.default')), ->default(config('queue.default')),
Toggle::make('done') Toggle::make('done')
->label('I have done both steps below.') ->label('I have done both steps below.')
->accepted(fn () => !file_exists('/.dockerenv')) ->accepted(fn () => !@file_exists('/.dockerenv'))
->inline(false) ->inline(false)
->validationMessages([ ->validationMessages([
'accepted' => 'You need to do both steps before continuing!', 'accepted' => 'You need to do both steps before continuing!',
]) ])
->hidden(fn () => file_exists('/.dockerenv')), ->hidden(fn () => @file_exists('/.dockerenv')),
TextInput::make('crontab') TextInput::make('crontab')
->label(new HtmlString('Run the following command to set up your crontab. Note that <code>www-data</code> is your webserver user. On some systems this username might be different!')) ->label(new HtmlString('Run the following command to set up your crontab. Note that <code>www-data</code> is your webserver user. On some systems this username might be different!'))
->disabled() ->disabled()
->hintAction(fn () => request()->isSecure() ? CopyAction::make() : null) ->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 -') ->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(), ->columnSpanFull(),
TextInput::make('queueService') TextInput::make('queueService')
->label(new HtmlString('To setup the queue worker service you simply have to run the following command.')) ->label(new HtmlString('To setup the queue worker service you simply have to run the following command.'))
->disabled() ->disabled()
->hintAction(fn () => request()->isSecure() ? CopyAction::make() : null) ->hintAction(fn () => request()->isSecure() ? CopyAction::make() : null)
->default('sudo php ' . base_path() . '/artisan p:environment:queue-service') ->default('sudo php ' . base_path() . '/artisan p:environment:queue-service')
->hidden(fn () => file_exists('/.dockerenv')) ->hidden(fn () => @file_exists('/.dockerenv'))
->columnSpanFull(), ->columnSpanFull(),
]) ])
->afterValidation(fn () => $installer->writeToEnv('env_queue')); ->afterValidation(fn () => $installer->writeToEnv('env_queue'));