Skip to content

Commit d60c55b

Browse files
authored
Magento Auto Sync Merge from: magento / magento2ce / develop
2 parents 9415286 + 2002ef2 commit d60c55b

File tree

88 files changed

+5905
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+5905
-223
lines changed

app/code/Magento/Authorizenet/etc/di.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,23 @@
2626
</argument>
2727
</arguments>
2828
</type>
29+
<type name="Magento\Config\Model\Config\TypePool">
30+
<arguments>
31+
<argument name="sensitive" xsi:type="array">
32+
<item name="payment/authorizenet_directpost/login" xsi:type="string">1</item>
33+
<item name="payment/authorizenet_directpost/trans_key" xsi:type="string">1</item>
34+
<item name="payment/authorizenet_directpost/trans_md5" xsi:type="string">1</item>
35+
<item name="payment/authorizenet_directpost/merchant_email" xsi:type="string">1</item>
36+
<item name="payment/authorizenet_directpost/cgi_url" xsi:type="string">1</item>
37+
<item name="payment/authorizenet_directpost/cgi_url_td" xsi:type="string">1</item>
38+
<item name="payment/authorizenet_directpost/email_customer" xsi:type="string">1</item>
39+
</argument>
40+
<argument name="environment" xsi:type="array">
41+
<item name="payment/authorizenet_directpost/cgi_url" xsi:type="string">1</item>
42+
<item name="payment/authorizenet_directpost/cgi_url_td" xsi:type="string">1</item>
43+
<item name="payment/authorizenet_directpost/debug" xsi:type="string">1</item>
44+
<item name="payment/authorizenet_directpost/test" xsi:type="string">1</item>
45+
</argument>
46+
</arguments>
47+
</type>
2948
</config>

app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
121121
]
122122
);
123123

124+
$fieldset->addField(
125+
'group_code',
126+
'text',
127+
[
128+
'name' => 'group[code]',
129+
'label' => __('Code'),
130+
'value' => $groupModel->getCode(),
131+
'required' => true,
132+
'disabled' => $groupModel->isReadOnly()
133+
]
134+
);
135+
124136
$categories = $this->_category->toOptionArray();
125137

126138
$fieldset->addField(

app/code/Magento/Backend/etc/di.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,24 @@
194194
</argument>
195195
</arguments>
196196
</type>
197+
<type name="Magento\Config\Model\Config\TypePool">
198+
<arguments>
199+
<argument name="sensitive" xsi:type="array">
200+
<item name="admin/url/custom" xsi:type="string">1</item>
201+
<item name="admin/url/custom_path" xsi:type="string">1</item>
202+
<item name="trans_email/ident_custom1/email" xsi:type="string">1</item>
203+
<item name="trans_email/ident_custom1/name" xsi:type="string">1</item>
204+
<item name="trans_email/ident_custom2/email" xsi:type="string">1</item>
205+
<item name="trans_email/ident_custom2/name" xsi:type="string">1</item>
206+
<item name="trans_email/ident_general/email" xsi:type="string">1</item>
207+
<item name="trans_email/ident_general/name" xsi:type="string">1</item>
208+
<item name="trans_email/ident_sales/email" xsi:type="string">1</item>
209+
<item name="trans_email/ident_sales/name" xsi:type="string">1</item>
210+
<item name="trans_email/ident_support/email" xsi:type="string">1</item>
211+
<item name="trans_email/ident_support/name" xsi:type="string">1</item>
212+
</argument>
213+
</arguments>
214+
</type>
197215
<type name="Magento\Backend\Model\View\Layout\Filter">
198216
<arguments>
199217
<argument name="filters" xsi:type="array">

app/code/Magento/Braintree/etc/di.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,4 +556,20 @@
556556
</argument>
557557
</arguments>
558558
</type>
559+
<type name="Magento\Config\Model\Config\TypePool">
560+
<arguments>
561+
<argument name="sensitive" xsi:type="array">
562+
<item name="payment/braintree/merchant_id" xsi:type="string">1</item>
563+
<item name="payment/braintree/private_key" xsi:type="string">1</item>
564+
<item name="payment/braintree/merchant_account_id" xsi:type="string">1</item>
565+
<item name="payment/braintree/kount_id" xsi:type="string">1</item>
566+
<item name="payment/braintree_paypal/merchant_name_override" xsi:type="string">1</item>
567+
<item name="payment/braintree/descriptor_phone" xsi:type="string">1</item>
568+
<item name="payment/braintree/descriptor_url" xsi:type="string">1</item>
569+
</argument>
570+
<argument name="environment" xsi:type="array">
571+
<item name="payment/braintree/descriptor_url" xsi:type="string">1</item>
572+
</argument>
573+
</arguments>
574+
</type>
559575
</config>

app/code/Magento/Checkout/etc/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,11 @@
4949
</argument>
5050
</arguments>
5151
</type>
52+
<type name="Magento\Config\Model\Config\TypePool">
53+
<arguments>
54+
<argument name="sensitive" xsi:type="array">
55+
<item name="checkout/payment_failed/copy_to" xsi:type="string">1</item>
56+
</argument>
57+
</arguments>
58+
</type>
5259
</config>

app/code/Magento/Config/App/Config/Source/DumpConfigSourceAggregated.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*/
66
namespace Magento\Config\App\Config\Source;
77

8+
use Magento\Config\Model\Config\TypePool;
89
use Magento\Config\Model\Config\Export\ExcludeList;
910
use Magento\Framework\App\Config\ConfigSourceInterface;
1011
use Magento\Framework\App\Config\ScopeConfigInterface;
12+
use Magento\Framework\App\ObjectManager;
1113

1214
/**
1315
* Class DumpConfigSourceAggregated aggregates configurations from all available sources
@@ -19,6 +21,13 @@ class DumpConfigSourceAggregated implements DumpConfigSourceInterface
1921
*/
2022
private $excludeList;
2123

24+
/**
25+
* Checker for config type.
26+
*
27+
* @var TypePool
28+
*/
29+
private $typePool;
30+
2231
/**
2332
* @var ConfigSourceInterface[]
2433
*/
@@ -37,11 +46,13 @@ class DumpConfigSourceAggregated implements DumpConfigSourceInterface
3746
/**
3847
* @param ExcludeList $excludeList
3948
* @param array $sources
49+
* @param TypePool|null $typePool
4050
*/
41-
public function __construct(ExcludeList $excludeList, array $sources = [])
51+
public function __construct(ExcludeList $excludeList, array $sources = [], TypePool $typePool = null)
4252
{
4353
$this->excludeList = $excludeList;
4454
$this->sources = $sources;
55+
$this->typePool = $typePool ?: ObjectManager::getInstance()->get(TypePool::class);
4556
}
4657

4758
/**
@@ -88,7 +99,7 @@ private function filterChain($path, &$data)
8899

89100
if ($filteredPath
90101
&& !is_array($data[$subKey])
91-
&& $this->excludeList->isPresent($filteredPath)
102+
&& $this->isExcludePath($filteredPath)
92103
) {
93104
$this->excludedFields[$newPath] = $filteredPath;
94105

@@ -99,6 +110,19 @@ private function filterChain($path, &$data)
99110
}
100111
}
101112

113+
/**
114+
* Checks if the configuration field belongs to a sensitive type.
115+
*
116+
* @param string $path Configuration field path. For example 'contact/email/recipient_email'
117+
* @return boolean
118+
*/
119+
private function isExcludePath($path)
120+
{
121+
return $this->excludeList->isPresent($path)
122+
|| $this->typePool->isPresent($path, TypePool::TYPE_ENVIRONMENT)
123+
|| $this->typePool->isPresent($path, TypePool::TYPE_SENSITIVE);
124+
}
125+
102126
/**
103127
* Eliminating scope info from path
104128
*

app/code/Magento/Config/Model/Config/Export/Comment.php

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
namespace Magento\Config\Model\Config\Export;
77

88
use Magento\Config\App\Config\Source\DumpConfigSourceInterface;
9+
use Magento\Config\Model\Config\TypePool;
910
use Magento\Config\Model\Placeholder\PlaceholderFactory;
1011
use Magento\Config\Model\Placeholder\PlaceholderInterface;
1112
use Magento\Framework\App\Config\CommentInterface;
13+
use Magento\Framework\App\ObjectManager;
1214

1315
/**
1416
* Class Comment. Is used to retrieve comment for config dump file
@@ -25,20 +27,43 @@ class Comment implements CommentInterface
2527
*/
2628
private $source;
2729

30+
/**
31+
* Checker for config type.
32+
*
33+
* @var TypePool
34+
*/
35+
private $typePool;
36+
37+
/**
38+
* Contains list of config fields which should be excluded from config export file.
39+
*
40+
* @var ExcludeList
41+
*/
42+
private $excludeList;
43+
2844
/**
2945
* @param PlaceholderFactory $placeholderFactory
3046
* @param DumpConfigSourceInterface $source
47+
* @param TypePool|null $typePool
48+
* @param ExcludeList|null $excludeList
3149
*/
3250
public function __construct(
3351
PlaceholderFactory $placeholderFactory,
34-
DumpConfigSourceInterface $source
52+
DumpConfigSourceInterface $source,
53+
TypePool $typePool = null,
54+
ExcludeList $excludeList = null
3555
) {
3656
$this->placeholder = $placeholderFactory->create(PlaceholderFactory::TYPE_ENVIRONMENT);
3757
$this->source = $source;
58+
$this->typePool = $typePool ?: ObjectManager::getInstance()->get(TypePool::class);
59+
$this->excludeList = $excludeList ?: ObjectManager::getInstance()->get(ExcludeList::class);
3860
}
3961

4062
/**
41-
* Retrieves comments for config export file.
63+
* Retrieves comments for the configuration export file.
64+
*
65+
* If there are sensitive fields in the configuration fields,
66+
* a list with descriptions of these fields will be added to the comments.
4267
*
4368
* @return string
4469
*/
@@ -47,7 +72,9 @@ public function get()
4772
$comment = '';
4873
$fields = $this->source->getExcludedFields();
4974
foreach ($fields as $path) {
50-
$comment .= "\n" . $this->placeholder->generate($path) . ' for ' . $path ;
75+
if ($this->isSensitive($path)) {
76+
$comment .= "\n" . $this->placeholder->generate($path) . ' for ' . $path;
77+
}
5178
}
5279
if ($comment) {
5380
$comment = 'The configuration file doesn\'t contain sensitive data for security reasons. '
@@ -56,4 +83,16 @@ public function get()
5683
}
5784
return $comment;
5885
}
86+
87+
/**
88+
* Checks whether the field path is sensitive.
89+
*
90+
* @param string $path Configuration field path
91+
* @return bool
92+
*/
93+
private function isSensitive($path)
94+
{
95+
return $this->typePool->isPresent($path, TypePool::TYPE_SENSITIVE)
96+
|| $this->excludeList->isPresent($path);
97+
}
5998
}

app/code/Magento/Config/Model/Config/Export/ExcludeList.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
*/
66
namespace Magento\Config\Model\Config\Export;
77

8-
use Magento\Framework\App\Config\ScopeConfigInterface;
9-
108
/**
11-
* Class ExcludeList contains list of config fields which should be excluded from config export file
9+
* Class ExcludeList contains list of config fields which should be excluded from config export file.
10+
*
11+
* @deprecated because in Magento since version 2.2.0 there are several
12+
* types for configuration fields that require special processing.
13+
* @see \Magento\Config\Model\Config\TypePool
1214
*/
1315
class ExcludeList
1416
{
@@ -30,16 +32,18 @@ public function __construct(array $configs = [])
3032
*
3133
* @param string $path
3234
* @return bool
35+
* @deprecated
3336
*/
3437
public function isPresent($path)
3538
{
36-
return !empty($this->configs[$path]) ;
39+
return !empty($this->configs[$path]);
3740
}
3841

3942
/**
4043
* Retrieves all excluded field paths for export
4144
*
4245
* @return array
46+
* @deprecated
4347
*/
4448
public function get()
4549
{

0 commit comments

Comments
 (0)