From b5445e1e56497f8bdc1de35a8325418c44b96d37 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 19 Mar 2024 13:42:12 +0100 Subject: Fix CLI install regressions (#6214) * Fix CLI install with prefix It was not possible to pass a blank prefix * Fix regression EXIT_CODE_ALREADY_EXISTS The dedicated exit code was not sent anymore when a user already exists --- cli/create-user.php | 4 ++++ cli/do-install.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/create-user.php b/cli/create-user.php index 61bbc3563..1be604a42 100755 --- a/cli/create-user.php +++ b/cli/create-user.php @@ -58,6 +58,10 @@ if (!empty($cliOptions->errors)) { $username = $cliOptions->user; +if (preg_grep("/^$username$/i", listUsers())) { + fail('FreshRSS warning: username already exists “' . $username . '”', EXIT_CODE_ALREADY_EXISTS); +} + echo 'FreshRSS creating user “', $username, "”…\n"; $values = [ diff --git a/cli/do-install.php b/cli/do-install.php index 77acc58ed..483a443d9 100755 --- a/cli/do-install.php +++ b/cli/do-install.php @@ -132,7 +132,7 @@ if ((!empty($config['base_url'])) && is_string($config['base_url']) && Minz_Requ $config['pubsubhubbub_enabled'] = true; } -$config['db'] = array_merge($config['db'], array_filter($dbValues)); +$config['db'] = array_merge($config['db'], array_filter($dbValues, static fn($value) => $value !== null)); performRequirementCheck($config['db']['type']); -- cgit v1.2.3