10 use Magento\Config\Console\Command\ConfigSet\ProcessorFacadeFactory;
16 use Symfony\Component\Console\Command\Command;
17 use Symfony\Component\Console\Input\InputArgument;
18 use Symfony\Component\Console\Input\InputInterface;
19 use Symfony\Component\Console\Input\InputOption;
20 use Symfony\Component\Console\Output\OutputInterface;
44 private $emulatedAreaProcessor;
51 private $changeDetector;
58 private $processorFacadeFactory;
65 private $deploymentConfig;
76 ProcessorFacadeFactory $processorFacadeFactory,
79 $this->emulatedAreaProcessor = $emulatedAreaProcessor;
80 $this->changeDetector = $changeDetector;
81 $this->processorFacadeFactory = $processorFacadeFactory;
84 parent::__construct();
93 $this->setName(
'config:set')
94 ->setDescription(
'Change system configuration')
98 InputArgument::REQUIRED,
99 'Configuration path in format section/group/field_name' 101 new InputArgument(static::ARG_VALUE, InputArgument::REQUIRED,
'Configuration value'),
103 static::OPTION_SCOPE,
105 InputArgument::OPTIONAL,
106 'Configuration scope (default, website, or store)',
110 static::OPTION_SCOPE_CODE,
112 InputArgument::OPTIONAL,
113 'Scope code (required only if scope is not \'default\')' 116 static::OPTION_LOCK_ENV,
118 InputOption::VALUE_NONE,
119 'Lock value which prevents modification in the Admin (will be saved in app/etc/env.php)' 122 static::OPTION_LOCK_CONFIG,
124 InputOption::VALUE_NONE,
125 'Lock and share value with other installations, prevents modification in the Admin ' 126 .
'(will be saved in app/etc/config.php)' 131 InputOption::VALUE_NONE,
132 'Deprecated, use the --' . static::OPTION_LOCK_ENV .
' option instead.' 147 if (!$this->deploymentConfig->isAvailable()) {
149 '<error>You cannot run this command because the Magento application is not installed.</error>' 156 .
'This command is unavailable right now. ' 157 .
'To continue working with it please run app:config:import or setup:upgrade command before.' 165 $message = $this->emulatedAreaProcessor->process(
function () use ($input) {
167 $lock = $input->getOption(static::OPTION_LOCK_ENV)
168 || $input->getOption(static::OPTION_LOCK_CONFIG)
169 || $input->getOption(static::OPTION_LOCK);
172 if ($input->getOption(static::OPTION_LOCK_CONFIG)) {
176 return $this->processorFacadeFactory->create()->processWithLockTarget(
177 $input->getArgument(static::ARG_PATH),
178 $input->getArgument(static::ARG_VALUE),
179 $input->getOption(static::OPTION_SCOPE),
180 $input->getOption(static::OPTION_SCOPE_CODE),
189 }
catch (\Exception $exception) {
190 $output->writeln(
'<error>' . $exception->getMessage() .
'</error>');
__construct(EmulatedAdminhtmlAreaProcessor $emulatedAreaProcessor, ChangeDetector $changeDetector, ProcessorFacadeFactory $processorFacadeFactory, DeploymentConfig $deploymentConfig)
execute(InputInterface $input, OutputInterface $output)