Skip to content

Commit c732b5d

Browse files
merge magento/2.3-develop into magento-helix/MAGETWO-95294-3
2 parents f229cb3 + ef58edb commit c732b5d

File tree

221 files changed

+8690
-1182
lines changed

Some content is hidden

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

221 files changed

+8690
-1182
lines changed

app/code/Magento/AdvancedSearch/etc/adminhtml/system.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@
4848
</depends>
4949
</field>
5050
<!--<group id="suggestions">-->
51-
<field id="search_suggestion_enabled" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
51+
<field id="search_suggestion_enabled" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
5252
<label>Enable Search Suggestions</label>
5353
<comment>When you enable this option your site may slow down.</comment>
5454
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
5555
</field>
56-
<field id="search_suggestion_count" translate="label" type="text" sortOrder="71" showInDefault="1" showInWebsite="1" showInStore="1">
56+
<field id="search_suggestion_count" translate="label" type="text" sortOrder="91" showInDefault="1" showInWebsite="1" showInStore="1">
5757
<label>Search Suggestions Count</label>
5858
<depends>
5959
<field id="search_suggestion_enabled">1</field>
6060
</depends>
6161
</field>
62-
<field id="search_suggestion_count_results_enabled" translate="label" type="select" sortOrder="72" showInDefault="1" showInWebsite="1" showInStore="1">
62+
<field id="search_suggestion_count_results_enabled" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1">
6363
<label>Show Results Count for Each Suggestion</label>
6464
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
6565
<comment>When you enable this option your site may slow down.</comment>

app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Backend\Block\System\Design\Edit\Tab;
88

9+
/**
10+
* General system tab block.
11+
*/
912
class General extends \Magento\Backend\Block\Widget\Form\Generic
1013
{
1114
/**
@@ -90,7 +93,7 @@ protected function _prepareForm()
9093
]
9194
);
9295

93-
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
96+
$dateFormat = $this->_localeDate->getDateFormatWithLongYear();
9497
$fieldset->addField(
9598
'date_from',
9699
'date',

app/code/Magento/Backend/Model/Session/Quote.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* @method Quote setOrderId($orderId)
2525
* @method int getOrderId()
2626
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
27+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2728
* @since 100.0.2
2829
*/
2930
class Quote extends \Magento\Framework\Session\SessionManager
@@ -149,7 +150,8 @@ public function getQuote()
149150
$this->_quote = $this->quoteFactory->create();
150151
if ($this->getStoreId()) {
151152
if (!$this->getQuoteId()) {
152-
$this->_quote->setCustomerGroupId($this->groupManagement->getDefaultGroup()->getId());
153+
$customerGroupId = $this->groupManagement->getDefaultGroup($this->getStoreId())->getId();
154+
$this->_quote->setCustomerGroupId($customerGroupId);
153155
$this->_quote->setIsActive(false);
154156
$this->_quote->setStoreId($this->getStoreId());
155157

app/code/Magento/Backend/Test/Unit/Model/Session/QuoteTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ public function testGetQuoteWithoutQuoteId()
267267
$cartInterfaceMock->expects($this->atLeastOnce())->method('getId')->willReturn($quoteId);
268268
$defaultGroup = $this->getMockBuilder(\Magento\Customer\Api\Data\GroupInterface::class)->getMock();
269269
$defaultGroup->expects($this->any())->method('getId')->will($this->returnValue($customerGroupId));
270-
$this->groupManagementMock->expects($this->any())->method('getDefaultGroup')->willReturn($defaultGroup);
270+
$this->groupManagementMock
271+
->method('getDefaultGroup')
272+
->with($storeId)
273+
->willReturn($defaultGroup);
271274

272275
$dataCustomerMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)
273276
->disableOriginalConstructor()

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<group id="debug" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
113113
<label>Debug</label>
114114
<field id="template_hints_storefront" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
115-
<label>Enabled Template Path Hints for Storefront</label>
115+
<label>Enable Template Path Hints for Storefront</label>
116116
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
117117
</field>
118118
<field id="template_hints_storefront_show_with_parameter" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
@@ -132,7 +132,7 @@
132132
<comment>Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]</comment>
133133
</field>
134134
<field id="template_hints_admin" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
135-
<label>Enabled Template Path Hints for Admin</label>
135+
<label>Enable Template Path Hints for Admin</label>
136136
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
137137
</field>
138138
<field id="template_hints_blocks" translate="label" type="select" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">

app/code/Magento/Backup/Model/Db.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Backup\Model;
77

88
use Magento\Backup\Helper\Data as Helper;
9+
use Magento\Backup\Model\ResourceModel\Table\GetListTables;
10+
use Magento\Backup\Model\ResourceModel\View\CreateViewsBackup;
911
use Magento\Framework\App\ObjectManager;
1012
use Magento\Framework\Exception\RuntimeException;
1113

@@ -44,18 +46,35 @@ class Db implements \Magento\Framework\Backup\Db\BackupDbInterface
4446
private $helper;
4547

4648
/**
47-
* @param \Magento\Backup\Model\ResourceModel\Db $resourceDb
49+
* @var GetListTables
50+
*/
51+
private $getListTables;
52+
53+
/**
54+
* @var CreateViewsBackup
55+
*/
56+
private $getViewsBackup;
57+
58+
/**
59+
* Db constructor.
60+
* @param ResourceModel\Db $resourceDb
4861
* @param \Magento\Framework\App\ResourceConnection $resource
4962
* @param Helper|null $helper
63+
* @param GetListTables|null $getListTables
64+
* @param CreateViewsBackup|null $getViewsBackup
5065
*/
5166
public function __construct(
52-
\Magento\Backup\Model\ResourceModel\Db $resourceDb,
67+
ResourceModel\Db $resourceDb,
5368
\Magento\Framework\App\ResourceConnection $resource,
54-
?Helper $helper = null
69+
?Helper $helper = null,
70+
?GetListTables $getListTables = null,
71+
?CreateViewsBackup $getViewsBackup = null
5572
) {
5673
$this->_resourceDb = $resourceDb;
5774
$this->_resource = $resource;
5875
$this->helper = $helper ?? ObjectManager::getInstance()->get(Helper::class);
76+
$this->getListTables = $getListTables ?? ObjectManager::getInstance()->get(GetListTables::class);
77+
$this->getViewsBackup = $getViewsBackup ?? ObjectManager::getInstance()->get(CreateViewsBackup::class);
5978
}
6079

6180
/**
@@ -161,7 +180,7 @@ public function createBackup(\Magento\Framework\Backup\Db\BackupInterface $backu
161180

162181
$this->getResource()->beginTransaction();
163182

164-
$tables = $this->getResource()->getTables();
183+
$tables = $this->getListTables->execute();
165184

166185
$backup->write($this->getResource()->getHeader());
167186

@@ -198,6 +217,8 @@ public function createBackup(\Magento\Framework\Backup\Db\BackupInterface $backu
198217
$backup->write($this->getResource()->getTableDataAfterSql($table));
199218
}
200219
}
220+
$this->getViewsBackup->execute($backup);
221+
201222
$backup->write($this->getResource()->getTableForeignKeysSql());
202223
$backup->write($this->getResource()->getTableTriggersSql());
203224
$backup->write($this->getResource()->getFooter());
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backup\Model\ResourceModel\Table;
9+
10+
use Magento\Framework\App\ResourceConnection;
11+
12+
/**
13+
* Provides full list of tables in the database. This list excludes views, to allow different backup process.
14+
*/
15+
class GetListTables
16+
{
17+
private const TABLE_TYPE = 'BASE TABLE';
18+
19+
/**
20+
* @var ResourceConnection
21+
*/
22+
private $resource;
23+
24+
/**
25+
* @param ResourceConnection $resource
26+
*/
27+
public function __construct(ResourceConnection $resource)
28+
{
29+
$this->resource = $resource;
30+
}
31+
32+
/**
33+
* Get list of database tables excluding views.
34+
*
35+
* @return array
36+
*/
37+
public function execute(): array
38+
{
39+
return $this->resource->getConnection('backup')->fetchCol(
40+
"SHOW FULL TABLES WHERE `Table_type` = ?",
41+
self::TABLE_TYPE
42+
);
43+
}
44+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backup\Model\ResourceModel\View;
9+
10+
use Magento\Framework\App\ResourceConnection;
11+
use Magento\Framework\Backup\Db\BackupInterface;
12+
use Magento\Framework\DB\Adapter\AdapterInterface;
13+
14+
/**
15+
* Creates backup of Views in the database.
16+
*/
17+
class CreateViewsBackup
18+
{
19+
/**
20+
* @var GetListViews
21+
*/
22+
private $getListViews;
23+
24+
/**
25+
* @var ResourceConnection
26+
*/
27+
private $resourceConnection;
28+
29+
/**
30+
* @var AdapterInterface
31+
*/
32+
private $connection;
33+
34+
/**
35+
* @param GetListViews $getListViews
36+
* @param ResourceConnection $resourceConnection
37+
*/
38+
public function __construct(
39+
GetListViews $getListViews,
40+
ResourceConnection $resourceConnection
41+
) {
42+
$this->getListViews = $getListViews;
43+
$this->resourceConnection = $resourceConnection;
44+
}
45+
46+
/**
47+
* Write backup data to backup file.
48+
*
49+
* @param BackupInterface $backup
50+
*/
51+
public function execute(BackupInterface $backup): void
52+
{
53+
$views = $this->getListViews->execute();
54+
55+
foreach ($views as $view) {
56+
$backup->write($this->getViewHeader($view));
57+
$backup->write($this->getDropViewSql($view));
58+
$backup->write($this->getCreateView($view));
59+
}
60+
}
61+
62+
/**
63+
* Retrieve Database connection for Backup.
64+
*
65+
* @return AdapterInterface
66+
*/
67+
private function getConnection(): AdapterInterface
68+
{
69+
if (!$this->connection) {
70+
$this->connection = $this->resourceConnection->getConnection('backup');
71+
}
72+
73+
return $this->connection;
74+
}
75+
76+
/**
77+
* Get CREATE VIEW query for the specific view.
78+
*
79+
* @param string $viewName
80+
* @return string
81+
*/
82+
private function getCreateView(string $viewName): string
83+
{
84+
$quotedViewName = $this->getConnection()->quoteIdentifier($viewName);
85+
$query = 'SHOW CREATE VIEW ' . $quotedViewName;
86+
$row = $this->getConnection()->fetchRow($query);
87+
$regExp = '/\sDEFINER\=\`([^`]*)\`\@\`([^`]*)\`/';
88+
$sql = preg_replace($regExp, '', $row['Create View']);
89+
90+
return $sql . ';' . "\n";
91+
}
92+
93+
/**
94+
* Prepare a header for View being dumped.
95+
*
96+
* @param string $viewName
97+
* @return string
98+
*/
99+
public function getViewHeader(string $viewName): string
100+
{
101+
$quotedViewName = $this->getConnection()->quoteIdentifier($viewName);
102+
return "\n--\n" . "-- Structure for view {$quotedViewName}\n" . "--\n\n";
103+
}
104+
105+
/**
106+
* Make sure that View being created is deleted if already exists.
107+
*
108+
* @param string $viewName
109+
* @return string
110+
*/
111+
public function getDropViewSql(string $viewName): string
112+
{
113+
$quotedViewName = $this->getConnection()->quoteIdentifier($viewName);
114+
return sprintf('DROP VIEW IF EXISTS %s;\n', $quotedViewName);
115+
}
116+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backup\Model\ResourceModel\View;
9+
10+
use Magento\Framework\App\ResourceConnection;
11+
12+
/**
13+
* Get list of database views.
14+
*/
15+
class GetListViews
16+
{
17+
private const TABLE_TYPE = 'VIEW';
18+
19+
/**
20+
* @var ResourceConnection
21+
*/
22+
private $resource;
23+
24+
/**
25+
* @param ResourceConnection $resource
26+
*/
27+
public function __construct(ResourceConnection $resource)
28+
{
29+
$this->resource = $resource;
30+
}
31+
32+
/**
33+
* Get list of database views.
34+
*
35+
* @return array
36+
*/
37+
public function execute(): array
38+
{
39+
return $this->resource->getConnection('backup')->fetchCol(
40+
"SHOW FULL TABLES WHERE `Table_type` = ?",
41+
self::TABLE_TYPE
42+
);
43+
}
44+
}

app/code/Magento/Catalog/Block/Product/View/Attributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function getAdditionalData(array $excludeAttr = [])
9494

9595
if (is_string($value) && strlen(trim($value))) {
9696
$data[$attribute->getAttributeCode()] = [
97-
'label' => __($attribute->getStoreLabel()),
97+
'label' => $attribute->getStoreLabel(),
9898
'value' => $value,
9999
'code' => $attribute->getAttributeCode(),
100100
];

0 commit comments

Comments
 (0)