From 561f00646556f3228c7b6b33a4477120fcf9e8d6 Mon Sep 17 00:00:00 2001 From: Danny Gershman Date: Mon, 15 Jul 2024 02:00:54 +0300 Subject: [PATCH] fixes for installer (#1097) --- RELEASENOTES.md | 3 +++ src/app/Http/Middleware/ConfigCheck.php | 13 +++++++------ src/app/Services/SettingsService.php | 11 ++++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 876e85f91..7f987cb2b 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,5 +1,8 @@ # Release Notes +### 4.3.6 (July 14, 2024) +* Fix for non-loading installer. + ### 4.3.5 (May 9, 2024) * Fix for BMLT based logins not working in some cases. * Fix for call detail records table on the Reports page that wouldn't render all records. Call events are now in a modal window with a magnifying glass that triggers the open. [#1034] diff --git a/src/app/Http/Middleware/ConfigCheck.php b/src/app/Http/Middleware/ConfigCheck.php index b8e53f9f3..99612e5fc 100644 --- a/src/app/Http/Middleware/ConfigCheck.php +++ b/src/app/Http/Middleware/ConfigCheck.php @@ -26,12 +26,13 @@ public function __construct(SettingsService $settingsService) */ public function handle(Request $request, Closure $next) { -// if (!file_exists('./config.php') && !str_ends_with($request->url(), 'installer')) { -// return response()->view( -// 'admin/installer', -// ['minimalRequiredSettings'=>$this->settingsService->minimalRequiredSettings()] -// ); -// } + if (!file_exists($this->settingsService->getConfigFilenameForEnvironment()) + && !str_ends_with($request->url(), 'installer')) { + return response()->view( + 'admin/installer', + ['minimalRequiredSettings'=>$this->settingsService->minimalRequiredSettings()] + ); + } return $next($request); } diff --git a/src/app/Services/SettingsService.php b/src/app/Services/SettingsService.php index ecb305345..274e4f68f 100644 --- a/src/app/Services/SettingsService.php +++ b/src/app/Services/SettingsService.php @@ -11,7 +11,7 @@ class SettingsService { - private string $version = "4.4.0"; + private string $version = "4.3.6"; private array $allowlist = [ 'announce_servicebody_volunteer_routing' => ['description' => '/helpline/announce_servicebody_volunteer_routing' , 'default' => false, 'overridable' => true, 'hidden' => false], 'blocklist' => ['description' => '/general/blocklist' , 'default' => '', 'overridable' => true, 'hidden' => false], @@ -131,8 +131,7 @@ class SettingsService public function __construct() { - @include(!getenv("ENVIRONMENT") ? base_path() . '/config.php' : - base_path() . '/config.' . getenv("ENVIRONMENT") . '.php'); + @include($this->getConfigFilenameForEnvironment()); $this->settings = get_defined_vars(); $this->localizations = new Localizations(); @@ -154,6 +153,12 @@ public function __construct() } } + public function getConfigFilenameForEnvironment(): string + { + return !getenv("ENVIRONMENT") ? base_path() . '/config.php' : + base_path() . '/config.' . getenv("ENVIRONMENT") . '.php'; + } + public function getShortLanguage(): string { return $this->shortLanguage;