12 use Symfony\Component\Console\Input\InputOption;
13 use Symfony\Component\Console\Input\InputInterface;
14 use Symfony\Component\Console\Output\OutputInterface;
32 private $installerFactory;
39 private $deploymentConfig;
47 private $objectManager;
52 private $localeValidator;
57 private $timezoneValidator;
62 private $currencyValidator;
67 private $urlValidator;
84 LocaleValidator $localeValidator,
85 TimezoneValidator $timezoneValidator,
86 CurrencyValidator $currencyValidator,
87 UrlValidator $urlValidator
89 $this->installerFactory = $installerFactory;
91 $this->objectManager = $objectManagerProvider->
get();
92 $this->localeValidator = $localeValidator;
93 $this->timezoneValidator = $timezoneValidator;
94 $this->currencyValidator = $currencyValidator;
95 $this->urlValidator = $urlValidator;
96 parent::__construct();
104 $this->setName(
'setup:store-config:set')
105 ->setDescription(
'Installs the store configuration. Deprecated since 2.2.0. Use config:set instead')
115 if (!$this->deploymentConfig->isAvailable()) {
117 "<info>Store settings can't be saved because the Magento application is not installed.</info>" 120 return \Magento\Framework\Console\Cli::RETURN_FAILURE;
126 return \Magento\Framework\Console\Cli::RETURN_FAILURE;
129 $installer->installUserConfig($input->getOptions());
130 return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
144 InputOption::VALUE_REQUIRED,
145 'URL the store is supposed to be available at. ' 146 .
'Deprecated, use config:set with path web/unsecure/base_url' 151 InputOption::VALUE_REQUIRED,
152 'Default language code. ' 153 .
'Deprecated, use config:set with path general/locale/code' 158 InputOption::VALUE_REQUIRED,
159 'Default time zone code. ' 160 .
'Deprecated, use config:set with path general/locale/timezone' 165 InputOption::VALUE_REQUIRED,
166 'Default currency code. ' 167 .
'Deprecated, use config:set with path currency/options/base, currency/options/default' 168 .
' and currency/options/allow' 173 InputOption::VALUE_REQUIRED,
175 .
'Deprecated, use config:set with path web/seo/use_rewrites' 180 InputOption::VALUE_REQUIRED,
181 'Use secure URLs. Enable this option only if SSL is available. ' 182 .
'Deprecated, use config:set with path web/secure/use_in_frontend' 187 InputOption::VALUE_REQUIRED,
188 'Base URL for SSL connection. ' 189 .
'Deprecated, use config:set with path web/secure/base_url' 194 InputOption::VALUE_REQUIRED,
195 'Run admin interface with SSL. ' 196 .
'Deprecated, use config:set with path web/secure/use_in_adminhtml' 201 InputOption::VALUE_REQUIRED,
202 'Whether to use a "security key" feature in Magento Admin URLs and forms. ' 203 .
'Deprecated, use config:set with path admin/security/use_form_key' 227 if (strcmp(
$value,
'{{base_url}}') == 0) {
230 $errorMsg = $this->validateUrl(
238 $errorMsg = $this->validateCodes(
239 $this->localeValidator,
245 $errorMsg = $this->validateCodes(
246 $this->timezoneValidator,
252 $errorMsg = $this->validateCodes(
253 $this->currencyValidator,
265 $errorMsg = $this->validateUrl(
275 $errorMsg = $this->validateBinaryValue(
281 $errorMsg = $this->validateBinaryValue(
287 if ($errorMsg !==
'') {
301 private function validateBinaryValue(
$value, $key)
305 $errorMsg =
'<error>' .
'Command option \'' . $key .
'\': Invalid
value. Possible values (0|1).</error>
'; 318 private function validateCodes($lists, $code, $type) 321 if (!$lists->isValid($code)) { 322 $errorMsg = '<error>
' . 'Command option \
'' .
$type .
'\': Invalid
value. To see possible values,
' 323 . "run command 'bin/magento info:
" . $type . ':list\'.</error>'; 336 private function validateUrl($url, $option, array $allowedSchemes) 340 if (!$this->urlValidator->isValid($url, $allowedSchemes)) { 341 $errorTemplate = '<error>Command option \'%s\': Invalid URL \'%s\'.' 342 . ' Domain Name should contain only letters, digits and hyphen.' 343 . ' And you should use only following schemes: \'%s\'.</error>'; 348 implode(', ', $allowedSchemes) __construct(InstallerFactory $installerFactory, DeploymentConfig $deploymentConfig, ObjectManagerProvider $objectManagerProvider, LocaleValidator $localeValidator, TimezoneValidator $timezoneValidator, CurrencyValidator $currencyValidator, UrlValidator $urlValidator)
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
const KEY_ADMIN_USE_SECURITY_KEY
const KEY_IS_SECURE_ADMIN
const KEY_BASE_URL_SECURE
execute(InputInterface $input, OutputInterface $output)
validate(InputInterface $input)