Skip to content

Commit

Permalink
ENGCOM-8230: Prevent "Overwrite the existing configuration for ...?" …
Browse files Browse the repository at this point in the history
…question #30077
  • Loading branch information
sidolov committed Sep 23, 2020
2 parents b2e7753 + 11cef3e commit 9b8d63b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;

/**
* Config Set Command
*/
class ConfigSetCommand extends AbstractSetupCommand
{
/**
Expand Down Expand Up @@ -72,6 +69,7 @@ protected function configure()

/**
* @inheritdoc
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -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(
'<question>Overwrite the existing configuration for ' . $option->getName() . '?[Y/n]</question>',
Expand Down

0 comments on commit 9b8d63b

Please sign in to comment.