From 036347701128a42280b1b461b2fe2bb0904abf11 Mon Sep 17 00:00:00 2001 From: Artur Kyryliuk Date: Wed, 12 Aug 2026 02:03:06 +0200 Subject: [PATCH] fix(core): missing connection file fix and crossplatform composer config fix --- composer.json | 1 + core/composer.json | 1 + core/src/Core.php | 24 +++++++++++++++++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 77cab91fca..9657c40b05 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,7 @@ "source": "https://github.com/evolution-cms/evolution/" }, "config": { + "bin-compat": "full", "vendor-dir": "vendor" }, "require": { diff --git a/core/composer.json b/core/composer.json index 9905426572..5b2e8d8800 100644 --- a/core/composer.json +++ b/core/composer.json @@ -103,6 +103,7 @@ "minConnections": 3 }, "vendor-dir": "vendor", + "bin-compat": "full", "allow-plugins": { "wikimedia/composer-merge-plugin": true, "pestphp/pest-plugin": true diff --git a/core/src/Core.php b/core/src/Core.php index 0231c9e22a..23447d13f8 100644 --- a/core/src/Core.php +++ b/core/src/Core.php @@ -6459,6 +6459,22 @@ public function getUserSettings() return $usrSettings; } + /** + * The settings are only readable when the CMS is installed: during install + * the tables do not exist yet, and on a bare checkout the connection config + * (config/database/connections/) has not been written at all. + */ + private function canReadSettingsFromDatabase(): bool + { + if (IN_INSTALL_MODE !== false) { + return false; + } + + $config = $this['config']; + + return $config->get('database.connections.' . $config->get('database.default', 'default')) !== null; + } + private function recoverySiteCache() { $siteCacheDir = $this->bootstrapPath(); @@ -6472,11 +6488,13 @@ private function recoverySiteCache() return; } + $useDatabase = $this->canReadSettingsFromDatabase(); + $cache = new Legacy\Cache(); $cache->setCachepath($siteCacheDir); $cache->setReport(false); - if (IN_INSTALL_MODE === false) + if ($useDatabase) $cache->buildCache($this); clearstatcache(); @@ -6486,7 +6504,7 @@ private function recoverySiteCache() if (!empty($this->config)) { return; } - if (IN_INSTALL_MODE === false) + if ($useDatabase) $this->config = Models\SystemSetting::all() ->pluck('setting_value', 'setting_name') ->toArray(); @@ -6494,7 +6512,7 @@ private function recoverySiteCache() if ($this->getConfig('enable_filter') === null) { return; } - if (IN_INSTALL_MODE === false) + if ($useDatabase) if (Models\SitePlugin::activePhx()->count() === 0) { $this->setConfig('enable_filter', '0'); }