Skip to content

Commit 8095caf

Browse files
author
Ivan Gavryshko
committed
MAGETWO-35667: Move install-user-configuration
- removed buliness loginc from StoreConfigurationDataMapper so now we have ability to set any value independently
1 parent 9828560 commit 8095caf

File tree

2 files changed

+2
-115
lines changed

2 files changed

+2
-115
lines changed

setup/src/Magento/Setup/Model/StoreConfigurationDataMapper.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class StoreConfigurationDataMapper
4343
Store::XML_PATH_UNSECURE_BASE_URL => self::KEY_BASE_URL,
4444
Store::XML_PATH_SECURE_BASE_URL => self::KEY_BASE_URL_SECURE,
4545
Data::XML_PATH_DEFAULT_LOCALE => self::KEY_LANGUAGE,
46+
Store::XML_PATH_SECURE_IN_FRONTEND => self::KEY_IS_SECURE,
47+
Store::XML_PATH_SECURE_IN_ADMINHTML => self::KEY_IS_SECURE_ADMIN,
4648
Data::XML_PATH_DEFAULT_TIMEZONE => self::KEY_TIMEZONE,
4749
Currency::XML_PATH_CURRENCY_BASE => self::KEY_CURRENCY,
4850
Currency::XML_PATH_CURRENCY_DEFAULT => self::KEY_CURRENCY,
@@ -59,39 +61,13 @@ class StoreConfigurationDataMapper
5961
public function getConfigData($installParamData)
6062
{
6163
$configData = [];
62-
if (!$this->isSecureUrlNeeded($installParamData) && isset($installParamData[self::KEY_BASE_URL_SECURE])) {
63-
unset($installParamData[self::KEY_BASE_URL_SECURE]);
64-
}
65-
66-
// Base URL is secure, add secure entries
67-
if (isset($installParamData[self::KEY_BASE_URL_SECURE])) {
68-
$this->pathDataMap = array_merge(
69-
$this->pathDataMap,
70-
[
71-
Store::XML_PATH_SECURE_IN_FRONTEND => self::KEY_IS_SECURE,
72-
Store::XML_PATH_SECURE_IN_ADMINHTML => self::KEY_IS_SECURE_ADMIN
73-
]
74-
);
75-
}
7664

7765
foreach ($this->pathDataMap as $path => $key) {
7866
$configData = $this->addParamToConfigData($configData, $installParamData, $key, $path);
7967
}
8068
return $configData;
8169
}
8270

83-
/**
84-
* Determine if secure URL is needed (use_secure or use_secure_admin flag is set.)
85-
*
86-
* @param array $installParamData
87-
* @return bool
88-
*/
89-
private function isSecureUrlNeeded($installParamData)
90-
{
91-
return ((isset($installParamData[self::KEY_IS_SECURE]) && $installParamData[self::KEY_IS_SECURE])
92-
|| (isset($installParamData[self::KEY_IS_SECURE_ADMIN]) && $installParamData[self::KEY_IS_SECURE_ADMIN]));
93-
}
94-
9571
/**
9672
* Adds an install parameter value to the configData structure
9773
*

setup/src/Magento/Setup/Test/Unit/Model/StoreConfigurationDataMapperTest.php

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -142,95 +142,6 @@ public function getConfigDataDataProvider()
142142
Url::XML_PATH_USE_SECURE_KEY => '1',
143143
],
144144
],
145-
'is_secure, is_secure_admin set but no secure base url' =>
146-
[
147-
[
148-
StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/',
149-
StoreConfigurationDataMapper::KEY_IS_SECURE => '1',
150-
StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1',
151-
],
152-
[
153-
Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/',
154-
],
155-
],
156-
'secure base url set but is_secure and is_secure_admin set to 0' =>
157-
[
158-
[
159-
StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/',
160-
StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1',
161-
StoreConfigurationDataMapper::KEY_IS_SECURE => '0',
162-
StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '0',
163-
],
164-
[
165-
Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/',
166-
],
167-
],
168-
'secure base url set but is_secure and is_secure_admin not set' =>
169-
[
170-
[
171-
StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/',
172-
StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1',
173-
],
174-
[
175-
Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/',
176-
],
177-
],
178-
'secure base url set, is_secure set to 0, is_secure_admin set to 1' =>
179-
[
180-
[
181-
StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/',
182-
StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1',
183-
StoreConfigurationDataMapper::KEY_IS_SECURE => '0',
184-
StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1',
185-
],
186-
[
187-
Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/',
188-
Store::XML_PATH_SECURE_IN_FRONTEND => '0',
189-
Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/',
190-
Store::XML_PATH_SECURE_IN_ADMINHTML => '1',
191-
],
192-
],
193-
'secure base url set, is_secure set to 1, is_secure_admin set to 0' =>
194-
[
195-
[
196-
StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/',
197-
StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1',
198-
StoreConfigurationDataMapper::KEY_IS_SECURE => '1',
199-
StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '0',
200-
],
201-
[
202-
Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/',
203-
Store::XML_PATH_SECURE_IN_FRONTEND => '1',
204-
Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/',
205-
Store::XML_PATH_SECURE_IN_ADMINHTML => '0',
206-
],
207-
],
208-
'secure base url set, is_secure not set, is_secure_admin set to 1' =>
209-
[
210-
[
211-
StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/',
212-
StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1',
213-
StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1',
214-
],
215-
[
216-
Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/',
217-
Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/',
218-
Store::XML_PATH_SECURE_IN_ADMINHTML => '1',
219-
],
220-
],
221-
'secure base url set, is_secure set to 1, is_secure_admin not set' =>
222-
[
223-
[
224-
StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/',
225-
StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1',
226-
StoreConfigurationDataMapper::KEY_IS_SECURE => '1',
227-
],
228-
[
229-
Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/',
230-
Store::XML_PATH_SECURE_IN_FRONTEND => '1',
231-
Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/',
232-
],
233-
],
234145
];
235146
}
236147
}

0 commit comments

Comments
 (0)