Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
dvesh3 committed Aug 2, 2023
1 parent cadfe61 commit b05b68d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions src/Configuration/DatahubConfigLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,16 @@ public function locate(string $name, $params = [])
$dirs = [];
$finder = new Finder();

if (is_dir(Dao::CONFIG_PATH)) {
array_push($dirs, Dao::CONFIG_PATH);
$defaultConfigDir = $params['defaultConfigDir'] ?? '';
if (is_dir($defaultConfigDir)) {
array_push($dirs, $defaultConfigDir);
}

$confDir = (string) ($_SERVER['PIMCORE_CONFIG_STORAGE_DIR_DATA_HUB'] ?? '');
if (!empty($confDir)) {
if (is_dir($confDir)) {
$dirs = [... $dirs, $confDir];
}

$symfonyConf = \Pimcore::getContainer()->getParameter('pimcore_data_hub');
$symfonyConfDir = $symfonyConf['config_location']['data_hub']['write_target']['options']['directory'];
if (!empty($symfonyConfDir)) {
$dirs = [... $dirs, $symfonyConfDir];
}

if (empty($dirs)) {
return [];
}
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/PimcoreDataHubExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function prepend(ContainerBuilder $container)
}
} else {
$configLocator = new \Pimcore\Bundle\DataHubBundle\Configuration\DatahubConfigLocator();
foreach ($configLocator->locate('config') as $config) {
foreach ($configLocator->locate('config', ['defaultConfigDir' => $configDir]) as $config) {
$configLoader->load($config);
}
}
Expand Down

0 comments on commit b05b68d

Please sign in to comment.