diff --git a/CHANGELOG.md b/CHANGELOG.md index 8182366..9215095 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# Version 12.5.0 + +## Feature + +* Preparation of a customer path for Magento backend storage of the configuration in `var/pacemaker/import/configuration` + + # Version 12.4.0 ## Bugfixes diff --git a/src/Command/AbstractImportCommand.php b/src/Command/AbstractImportCommand.php index 667cbfa..2aa351b 100644 --- a/src/Command/AbstractImportCommand.php +++ b/src/Command/AbstractImportCommand.php @@ -56,6 +56,7 @@ protected function configure() ->addOption(InputOptionKeysInterface::MAGENTO_VERSION, null, InputOption::VALUE_REQUIRED, 'The Magento version to be used, e. g. "2.1.2"') ->addOption(InputOptionKeysInterface::CONFIGURATION, null, InputOption::VALUE_REQUIRED, 'Specify the pathname to the configuration file to use') ->addOption(InputOptionKeysInterface::CUSTOM_CONFIGURATION_DIR, null, InputOption::VALUE_REQUIRED, 'The path to the custom configuration directory') + ->addOption(InputOptionKeysInterface::CUSTOM_CONFIGURATION_PUBLIC_DIR, null, InputOption::VALUE_OPTIONAL, 'The path to the custom configuration public directory') ->addOption(InputOptionKeysInterface::SOURCE_DIR, null, InputOption::VALUE_REQUIRED, 'The directory that has to be watched for new files') ->addOption(InputOptionKeysInterface::TARGET_DIR, null, InputOption::VALUE_REQUIRED, 'The target directory with the files that has been imported') ->addOption(InputOptionKeysInterface::ARCHIVE_DIR, null, InputOption::VALUE_REQUIRED, 'The directory the imported files will be archived in') diff --git a/src/Command/AbstractSimpleImportCommand.php b/src/Command/AbstractSimpleImportCommand.php index 0f51edd..9c2f4fc 100644 --- a/src/Command/AbstractSimpleImportCommand.php +++ b/src/Command/AbstractSimpleImportCommand.php @@ -59,6 +59,7 @@ protected function configure() ->addOption(InputOptionKeysInterface::MAGENTO_EDITION, null, InputOption::VALUE_REQUIRED, 'The Magento edition to be used, either one of "CE" or "EE"', 'CE') ->addOption(InputOptionKeysInterface::CONFIGURATION, null, InputOption::VALUE_REQUIRED, 'Specify the pathname to the configuration file to use') ->addOption(InputOptionKeysInterface::CUSTOM_CONFIGURATION_DIR, null, InputOption::VALUE_REQUIRED, 'The path to the custom configuration directory') + ->addOption(InputOptionKeysInterface::CUSTOM_CONFIGURATION_PUBLIC_DIR, null, InputOption::VALUE_OPTIONAL, 'The path to the custom configuration public directory') ->addOption(InputOptionKeysInterface::LOG_LEVEL, null, InputOption::VALUE_REQUIRED, 'The log level to use') ->addOption(InputOptionKeysInterface::LOG_FILE, null, InputOption::VALUE_REQUIRED, 'The log file to use'); } diff --git a/src/Command/InputOptionKeys.php b/src/Command/InputOptionKeys.php index ef24243..eeb5622 100644 --- a/src/Command/InputOptionKeys.php +++ b/src/Command/InputOptionKeys.php @@ -67,6 +67,7 @@ public function __construct(array $inputOptionKeys = array()) InputOptionKeysInterface::CACHE_ENABLED, InputOptionKeysInterface::MOVE_FILES_PREFIX, InputOptionKeysInterface::CUSTOM_CONFIGURATION_DIR, + InputOptionKeysInterface::CUSTOM_CONFIGURATION_PUBLIC_DIR, InputOptionKeysInterface::RENDER_VALIDATION_ISSUES, InputOptionKeysInterface::EMPTY_ATTRIBUTE_VALUE_CONSTANT, InputOptionKeysInterface::STRICT_MODE, diff --git a/src/Configuration/LibraryLoader.php b/src/Configuration/LibraryLoader.php index f5e8d16..cf3cefa 100644 --- a/src/Configuration/LibraryLoader.php +++ b/src/Configuration/LibraryLoader.php @@ -80,6 +80,16 @@ protected function getCustomConfigurationDir() return $this->getContainer()->getParameter(DependencyInjectionKeys::APPLICATION_CUSTOM_CONFIGURATION_DIR); } + /** + * Return's the relative path to the custom configuration public directory. + * + * @return string The relative path to the custom configuration public directory + */ + protected function getCustomConfigurationPublicDir() + { + return $this->getContainer()->getParameter(DependencyInjectionKeys::APPLICATION_CUSTOM_CONFIGURATION_PUBLIC_DIR); + } + /** * Load's the external libraries registered in the passed configuration. * diff --git a/src/SimpleConfigurationLoader.php b/src/SimpleConfigurationLoader.php index 92f8b4a..f69b3ea 100644 --- a/src/SimpleConfigurationLoader.php +++ b/src/SimpleConfigurationLoader.php @@ -308,6 +308,15 @@ protected function createConfiguration($filename = null) ) ); + // initialize the default custom configuration directory + $customConfigurationPublicDir = implode( + DIRECTORY_SEPARATOR, + array_merge( + [$installationDir], + explode('/', $this->getContainer()->getParameter(DependencyInjectionKeys::APPLICATION_CUSTOM_CONFIGURATION_PUBLIC_DIR)) + ) + ); + // query whether or not a custom configuration directory has been speified, if yes override the default one if ($this->input->hasOptionSpecified(InputOptionKeysInterface::CUSTOM_CONFIGURATION_DIR) && $this->input->getOption(InputOptionKeysInterface::CUSTOM_CONFIGURATION_DIR)) { $customConfigurationDir = $this->input->getOption(InputOptionKeysInterface::CUSTOM_CONFIGURATION_DIR); @@ -318,6 +327,11 @@ protected function createConfiguration($filename = null) $directories[] = $customConfigurationDir; } + // specify the default directory for custom configuration public files + if (is_dir($customConfigurationPublicDir)) { + $directories[] = $customConfigurationPublicDir; + } + // load and return the configuration from the files found in the passed directories $completeConfiguration = $this->configurationFactory->factoryFromDirectories($installationDir, $defaultConfigurationDir, $directories, $format, $params, $paramsFile); diff --git a/symfony/Resources/config/services.xml b/symfony/Resources/config/services.xml index e7cfdb1..28ca3fc 100644 --- a/symfony/Resources/config/services.xml +++ b/symfony/Resources/config/services.xml @@ -9,6 +9,7 @@ .semver etc app/etc + var/pacemaker/import TechDivision\Import\Utils\EditionNamesInterface::CE TechDivision\Import\Utils\EditionNamesInterface::EE diff --git a/symfony/Utils/DependencyInjectionKeys.php b/symfony/Utils/DependencyInjectionKeys.php index 2f5f358..8174fee 100644 --- a/symfony/Utils/DependencyInjectionKeys.php +++ b/symfony/Utils/DependencyInjectionKeys.php @@ -123,4 +123,11 @@ class DependencyInjectionKeys extends \TechDivision\Import\App\Utils\DependencyI * @var string */ const APPLICATION_CUSTOM_CONFIGURATION_DIR = 'application.custom.configuration.dir'; + + /** + * The key for the DI parameter that contains the custom configuration public directory. + * + * @var string + */ + const APPLICATION_CUSTOM_CONFIGURATION_PUBLIC_DIR = 'application.custom.configuration.public.dir'; }