diff --git a/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php b/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php index e8ff8f09c345e..9380a7b72d6b2 100644 --- a/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php +++ b/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php @@ -14,9 +14,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; -/** - * Config Set Command - */ class ConfigSetCommand extends AbstractSetupCommand { /** @@ -72,6 +69,7 @@ protected function configure() /** * @inheritdoc + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -84,7 +82,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $commandOptions[$option->getName()] = false; $currentValue = $this->deploymentConfig->get($option->getConfigPath()); - if (($currentValue !== null) && ($inputOptions[$option->getName()] !== null)) { + $needOverwrite = ($currentValue !== null) && + ($inputOptions[$option->getName()] !== null) && + ($inputOptions[$option->getName()] !== $currentValue); + if ($needOverwrite) { $dialog = $this->getHelperSet()->get('question'); $question = new Question( 'Overwrite the existing configuration for ' . $option->getName() . '?[Y/n]',