Skip to content

Commit 9b8d63b

Browse files
authored
ENGCOM-8230: Prevent "Overwrite the existing configuration for ...?" question #30077
2 parents b2e7753 + 11cef3e commit 9b8d63b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Console\Output\OutputInterface;
1515
use Symfony\Component\Console\Question\Question;
1616

17-
/**
18-
* Config Set Command
19-
*/
2017
class ConfigSetCommand extends AbstractSetupCommand
2118
{
2219
/**
@@ -72,6 +69,7 @@ protected function configure()
7269

7370
/**
7471
* @inheritdoc
72+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
7573
*/
7674
protected function execute(InputInterface $input, OutputInterface $output)
7775
{
@@ -84,7 +82,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
8482
$commandOptions[$option->getName()] = false;
8583

8684
$currentValue = $this->deploymentConfig->get($option->getConfigPath());
87-
if (($currentValue !== null) && ($inputOptions[$option->getName()] !== null)) {
85+
$needOverwrite = ($currentValue !== null) &&
86+
($inputOptions[$option->getName()] !== null) &&
87+
($inputOptions[$option->getName()] !== $currentValue);
88+
if ($needOverwrite) {
8889
$dialog = $this->getHelperSet()->get('question');
8990
$question = new Question(
9091
'<question>Overwrite the existing configuration for ' . $option->getName() . '?[Y/n]</question>',

0 commit comments

Comments
 (0)