scopeValidator = $scopeValidator; $this->pathValidator = $pathValidator; $this->configSetProcessorFactory = $configSetProcessorFactory; $this->hash = $hash; $this->scopeConfig = $scopeConfig; } /** * Processes config:set command. * * @param string $path The configuration path in format section/group/field_name * @param string $value The configuration value * @param string $scope The configuration scope (default, website, or store) * @param string $scopeCode The scope code * @param boolean $lock The lock flag * @return string Processor response message * @throws ValidatorException If some validation is wrong * @since 101.0.0 * @deprecated 101.0.4 * @see processWithLockTarget() */ public function process($path, $value, $scope, $scopeCode, $lock) { return $this->processWithLockTarget($path, $value, $scope, $scopeCode, $lock); } /** * Processes config:set command with the option to set a target file. * * @param string $path The configuration path in format section/group/field_name * @param string $value The configuration value * @param string $scope The configuration scope (default, website, or store) * @param string $scopeCode The scope code * @param boolean $lock The lock flag * @param string $lockTarget * @return string Processor response message * @throws ValidatorException If some validation is wrong * @since 101.0.4 */ public function processWithLockTarget( $path, $value, $scope, $scopeCode, $lock, $lockTarget = ConfigFilePool::APP_ENV ) { try { $this->scopeValidator->isValid($scope, $scopeCode); $this->pathValidator->validate($path); } catch (LocalizedException $exception) { throw new ValidatorException(__($exception->getMessage()), $exception); } $processor = $lock ? ( $lockTarget == ConfigFilePool::APP_ENV ? $this->configSetProcessorFactory->create(ConfigSetProcessorFactory::TYPE_LOCK_ENV) : $this->configSetProcessorFactory->create(ConfigSetProcessorFactory::TYPE_LOCK_CONFIG) ) : $this->configSetProcessorFactory->create(ConfigSetProcessorFactory::TYPE_DEFAULT) ; $message = $lock ? ( $lockTarget == ConfigFilePool::APP_ENV ? 'Value was saved in app/etc/env.php and locked.' : 'Value was saved in app/etc/config.php and locked.' ) : 'Value was saved.'; // The processing flow depends on --lock and --share options. $processor->process($path, $value, $scope, $scopeCode); $this->hash->regenerate(System::CONFIG_TYPE); if ($this->scopeConfig instanceof Config) { $this->scopeConfig->clean(); } return $message; } }