From 0521c401f0413428d00d0c8b37782362e02393d3 Mon Sep 17 00:00:00 2001 From: Martin Price Date: Mon, 7 Jul 2025 10:15:58 +0100 Subject: [PATCH 1/2] Issue #465: Error on config import to db config storage --- CHANGELOG.md | 3 ++- commands/config.bee.inc | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab41a133..78666093 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project follows the which is based on the major version of Backdrop CMS with a semantic version system for each contributed module, theme and layout. -## [Unreleased] - 2025-04-30 +## [Unreleased] - 2025-07-07 ### Added - An option for the `db-import` command to allow import from newer MariaDB @@ -22,6 +22,7 @@ layout templates or Backdrop itself. ### Fixed - Unhandled errors and warnings if commands run outside Backdrop root and/or before installing Backdrop. +- Error if importing config to database config storage. ### Changed - Bee will now notify the user of additional modules that will be enabled or disabled diff --git a/commands/config.bee.inc b/commands/config.bee.inc index 51a44489..9cbb5115 100644 --- a/commands/config.bee.inc +++ b/commands/config.bee.inc @@ -312,7 +312,7 @@ function config_import_bee_callback($arguments, $options) { backdrop_flush_all_caches(); bee_message(bt("Config was imported to '!active'.", array( - '!active' => config_get_config_directory('active'), + '!active' => config_bee_get_config_location('active'), )), 'success'); bee_message(format_plural(count($rows), '1 file was synced.', @@ -338,6 +338,28 @@ function config_export_bee_callback($arguments, $options) { } bee_message(bt("Config was exported to '!staging'.", array( - '!staging' => config_get_config_directory('staging'), + '!staging' => config_bee_get_config_location('staging'), )), 'success'); } + +/** + * Helper function to get config storage location. + * + * @param string $type + * The type of config location: 'active' or 'staging'. + * + * @return string + * The selected storage location. + */ +function config_bee_get_config_location($type) { + $class = settings_get('config_' . $type . '_class', 'ConfigFileStorage'); + switch ($class) { + case 'ConfigDatabaseStorage': + $config_location = 'db://default/config_' . $type; + break; + case 'ConfigFileStorage': + default: + $config_location = config_get_config_directory($type); + } + return $config_location; +} From 836f2213d3c8971bf4ec213d751f62290371acf8 Mon Sep 17 00:00:00 2001 From: Martin Price <20357797+yorkshire-pudding@users.noreply.github.com> Date: Tue, 8 Jul 2025 08:11:20 +0100 Subject: [PATCH 2/2] Update CHANGELOG date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78666093..f4998dd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project follows the which is based on the major version of Backdrop CMS with a semantic version system for each contributed module, theme and layout. -## [Unreleased] - 2025-07-07 +## [Unreleased] - 2025-07-08 ### Added - An option for the `db-import` command to allow import from newer MariaDB