Skip to content

Commit

Permalink
Fix Pimcore ignores the constant PIMCORE_CONFIGURATION_DIRECTORY (pim…
Browse files Browse the repository at this point in the history
…core#15735)

* Fix Pimcore ignores the constant PIMCORE_CONFIGURATION_DIRECTORY - resolves pimcore#15534

* Fix Pimcore ignores the constant PIMCORE_CONFIGURATION_DIRECTORY - add bc layer

* Docs changes
  • Loading branch information
dvesh3 committed Aug 14, 2023
1 parent f946d4e commit eab0527
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
6 changes: 5 additions & 1 deletion bundles/AdminBundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
;

ConfigurationHelper::addConfigLocationWithWriteTargetNodes($rootNode, ['admin_system_settings' => '/var/config/admin_system_settings'], ['read_target']);
ConfigurationHelper::addConfigLocationWithWriteTargetNodes(
$rootNode,
['admin_system_settings' => PIMCORE_CONFIGURATION_DIRECTORY . '/admin_system_settings'],
['read_target']
);

return $treeBuilder;
}
Expand Down
29 changes: 17 additions & 12 deletions bundles/CoreBundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,25 @@ public function getConfigTreeBuilder(): TreeBuilder
$this->buildRedirectsStatusCodes($rootNode);
$this->addTemplatingEngineNode($rootNode);
$storageNode = ConfigurationHelper::addConfigLocationWithWriteTargetNodes($rootNode, [
'image_thumbnails' => '/var/config/image_thumbnails',
'custom_reports' => '/var/config/custom_reports',
'video_thumbnails' => '/var/config/video_thumbnails',
'document_types' => '/var/config/document_types',
'web_to_print' => '/var/config/web_to_print',
'predefined_properties' => '/var/config/predefined_properties',
'predefined_asset_metadata' => '/var/config/predefined_asset_metadata',
'staticroutes' => '/var/config/staticroutes',
'perspectives' => '/var/config/perspectives',
'custom_views' => '/var/config/custom_views',
'object_custom_layouts' => '/var/config/object_custom_layouts',
'image_thumbnails' => PIMCORE_CONFIGURATION_DIRECTORY . '/image_thumbnails',
'custom_reports' => PIMCORE_CONFIGURATION_DIRECTORY . '/custom_reports',
'video_thumbnails' => PIMCORE_CONFIGURATION_DIRECTORY . '/video_thumbnails',
'document_types' => PIMCORE_CONFIGURATION_DIRECTORY . '/document_types',
'web_to_print' => PIMCORE_CONFIGURATION_DIRECTORY . '/web_to_print',
'predefined_properties' => PIMCORE_CONFIGURATION_DIRECTORY . '/predefined_properties',
'predefined_asset_metadata' => PIMCORE_CONFIGURATION_DIRECTORY . '/predefined_asset_metadata',
'staticroutes' => PIMCORE_CONFIGURATION_DIRECTORY . '/staticroutes',
'perspectives' => PIMCORE_CONFIGURATION_DIRECTORY . '/perspectives',
'custom_views' => PIMCORE_CONFIGURATION_DIRECTORY . '/custom_views',
'object_custom_layouts' => PIMCORE_CONFIGURATION_DIRECTORY . '/object_custom_layouts',
]);

ConfigurationHelper::addConfigLocationTargetNode($storageNode, 'system_settings', '/var/config/system_settings', ['read_target']);
ConfigurationHelper::addConfigLocationTargetNode(
$storageNode,
'system_settings',
PIMCORE_CONFIGURATION_DIRECTORY . '/system_settings',
['read_target']
);

return $treeBuilder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public static function addConfigLocationTargetNode(
string $folder,
array $additionalNodes = []
): void {
//BC reasons: Remove this check in Pimcore 12
if (!str_starts_with($folder, PIMCORE_PROJECT_ROOT)) {
$folder = PIMCORE_PROJECT_ROOT . $folder;
}

if (in_array('read_target', $additionalNodes)) {
$node->
arrayNode($name)
Expand All @@ -61,7 +66,7 @@ public static function addConfigLocationTargetNode(
->defaultValue('symfony-config')
->end()
->arrayNode('options')
->defaultValue(['directory' => '%kernel.project_dir%' . $folder])
->defaultValue(['directory' => $folder])
->variablePrototype()->end()
->end()
->end()
Expand Down Expand Up @@ -93,7 +98,7 @@ public static function addConfigLocationTargetNode(
->defaultValue('symfony-config')
->end()
->arrayNode('options')
->defaultValue(['directory' => '%kernel.project_dir%' . $folder])
->defaultValue(['directory' => $folder])
->variablePrototype()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The following options are available:

#### Storage directory for symfony Config files

The default storage directory for Symfony Config files is `/var/config/...`.
The default storage directory for Symfony Config files is defined by `PIMCORE_CONFIGURATION_DIRECTORY`.

Available options for write targets and directory for Symfony Config files are:
```yaml
Expand Down

0 comments on commit eab0527

Please sign in to comment.