Skip to content

Commit 1f0bcbf

Browse files
Merge branch '2.4-develop' into dcmm2020
2 parents ade5168 + aa272e6 commit 1f0bcbf

File tree

897 files changed

+33176
-8744
lines changed

Some content is hidden

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

897 files changed

+33176
-8744
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ trim_trailing_whitespace = true
1010

1111
[*.md]
1212
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,json}]
15+
indent_size = 2
16+
17+
[{composer, auth}.json]
18+
indent_size = 4

.github/stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Configuration for probot-stale - https://github.com/probot/stale
22

33
# Number of days of inactivity before an Issue or Pull Request becomes stale
4-
daysUntilStale: 76
4+
daysUntilStale: 76
55

66
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
77
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
@@ -18,7 +18,7 @@ exemptLabels:
1818
- "Progress: dev in progress"
1919
- "Progress: PR in progress"
2020
- "Progress: done"
21-
- "B2B: GraphQL"
21+
- "B2B: GraphQL"
2222
- "Progress: PR Created"
2323
- "PAP"
2424
- "Project: Login as Customer"

app/code/Magento/AdminNotification/Block/ToolbarEntry.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* Toolbar entry that shows latest notifications
1111
*
1212
* @api
13-
* @author Magento Core Team <[email protected]>
1413
* @since 100.0.2
1514
*/
1615
class ToolbarEntry extends \Magento\Backend\Block\Template

app/code/Magento/AdminNotification/Model/Feed.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
/**
1313
* AdminNotification Feed model
1414
*
15-
* @author Magento Core Team <[email protected]>
1615
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1716
* @api
1817
* @since 100.0.2

app/code/Magento/AdminNotification/Model/InboxInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/**
99
* AdminNotification Inbox interface
1010
*
11-
* @author Magento Core Team <[email protected]>
1211
* @api
1312
* @since 100.0.2
1413
*/

app/code/Magento/AdminNotification/Model/NotificationService.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/**
99
* Notification service model
1010
*
11-
* @author Magento Core Team <[email protected]>
1211
* @api
1312
* @since 100.0.2
1413
*/

app/code/Magento/AdminNotification/Model/ResourceModel/Grid/Collection.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
/**
88
* AdminNotification Inbox model
9-
*
10-
* @author Magento Core Team <[email protected]>
119
*/
1210
namespace Magento\AdminNotification\Model\ResourceModel\Grid;
1311

app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
* AdminNotification Inbox model
1010
*
1111
* @api
12-
* @author Magento Core Team <[email protected]>
13-
* @api
1412
* @since 100.0.2
1513
*/
1614
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection

app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Unread.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
/**
88
* Collection of unread notifications
9-
*
10-
* @author Magento Core Team <[email protected]>
119
*/
1210
namespace Magento\AdminNotification\Model\ResourceModel\Inbox\Collection;
1311

app/code/Magento/AdminNotification/Observer/PredispatchAdminActionControllerObserver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
/**
1111
* AdminNotification observer
12-
*
13-
* @author Magento Core Team <[email protected]>
12+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1413
*/
1514
class PredispatchAdminActionControllerObserver implements ObserverInterface
1615
{

app/code/Magento/AdvancedSearch/Block/Adminhtml/Search/Edit.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* Search queries relations grid container
1010
*
1111
* @api
12-
* @author Magento Core Team <[email protected]>
1312
* @since 100.0.2
1413
*/
1514
class Edit extends \Magento\Backend\Block\Widget\Grid\Container

app/code/Magento/AdvancedSearch/Block/Adminhtml/Search/Grid.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* Search query relations edit grid
1010
*
1111
* @api
12-
* @author Magento Core Team <[email protected]>
1312
* @since 100.0.2
1413
*/
1514
class Grid extends \Magento\Backend\Block\Widget\Grid

app/code/Magento/AdvancedSearch/Model/ResourceModel/Recommendations.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/**
99
* Catalog search recommendations resource model
1010
*
11-
* @author Magento Core Team <[email protected]>
1211
* @api
1312
* @since 100.0.2
1413
*/

app/code/Magento/Analytics/Model/ReportWriter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ public function write(WriteInterface $directory, $path)
103103
/**
104104
* Replace wrong symbols in row
105105
*
106+
* Strip backslashes before double quotes so they will be properly escaped in the generated csv
107+
*
108+
* @see fputcsv()
106109
* @param array $row
107110
* @return array
108111
*/
109112
private function prepareRow(array $row): array
110113
{
111-
$row = preg_replace('/(?<!\\\\)"/', '\\"', $row);
112-
$row = preg_replace('/[\\\\]+/', '\\', $row);
113-
114-
return $row;
114+
return preg_replace('/\\\+(?=\")/', '', $row);
115115
}
116116
}

app/code/Magento/Analytics/ReportXml/ConnectionFactory.php

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,65 @@
66

77
namespace Magento\Analytics\ReportXml;
88

9-
use Magento\Framework\App\ResourceConnection;
10-
use Magento\Framework\ObjectManagerInterface;
9+
use Magento\Framework\App\DeploymentConfig;
10+
use Magento\Framework\App\ResourceConnection\ConfigInterface as ResourceConfigInterface;
11+
use Magento\Framework\Config\ConfigOptionsListConstants;
1112
use Magento\Framework\DB\Adapter\AdapterInterface;
13+
use Magento\Framework\Model\ResourceModel\Type\Db\ConnectionFactoryInterface;
1214

1315
/**
1416
* Creates connection instance for export according to existing one
17+
*
1518
* This connection does not use buffered statement, also this connection is not persistent
1619
*/
1720
class ConnectionFactory
1821
{
1922
/**
20-
* @var ResourceConnection
23+
* @var ResourceConfigInterface
2124
*/
22-
private $resourceConnection;
25+
private $resourceConfig;
2326

2427
/**
25-
* @var ObjectManagerInterface
28+
* @var DeploymentConfig
2629
*/
27-
private $objectManager;
30+
private $deploymentConfig;
2831

2932
/**
30-
* @param ResourceConnection $resourceConnection
31-
* @param ObjectManagerInterface $objectManager
33+
* @var ConnectionFactoryInterface
34+
*/
35+
private $connectionFactory;
36+
37+
/**
38+
* @param ResourceConfigInterface $resourceConfig
39+
* @param DeploymentConfig $deploymentConfig
40+
* @param ConnectionFactoryInterface $connectionFactory
3241
*/
3342
public function __construct(
34-
ResourceConnection $resourceConnection,
35-
ObjectManagerInterface $objectManager
43+
ResourceConfigInterface $resourceConfig,
44+
DeploymentConfig $deploymentConfig,
45+
ConnectionFactoryInterface $connectionFactory
3646
) {
37-
$this->resourceConnection = $resourceConnection;
38-
$this->objectManager = $objectManager;
47+
$this->resourceConfig = $resourceConfig;
48+
$this->deploymentConfig = $deploymentConfig;
49+
$this->connectionFactory = $connectionFactory;
3950
}
4051

4152
/**
4253
* Creates one-time connection for export
4354
*
44-
* @param string $connectionName
55+
* @param string $resourceName
4556
* @return AdapterInterface
4657
*/
47-
public function getConnection($connectionName)
58+
public function getConnection($resourceName)
4859
{
49-
$connection = $this->resourceConnection->getConnection($connectionName);
50-
$connectionClassName = get_class($connection);
51-
$configData = $connection->getConfig();
60+
$connectionName = $this->resourceConfig->getConnectionName($resourceName);
61+
$configData = $this->deploymentConfig->get(
62+
ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/' . $connectionName
63+
);
5264
$configData['use_buffered_query'] = false;
5365
unset($configData['persistent']);
54-
return $this->objectManager->create(
55-
$connectionClassName,
56-
[
57-
'config' => $configData
58-
]
59-
);
66+
$connection = $this->connectionFactory->create($configData);
67+
68+
return $connection;
6069
}
6170
}

app/code/Magento/Analytics/Test/Unit/Model/ReportWriterTest.php

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function setUp(): void
103103
* @param array $expectedFileData
104104
* @return void
105105
*
106-
* @dataProvider configDataProvider
106+
* @dataProvider writeDataProvider
107107
*/
108108
public function testWrite(array $configData, array $fileData, array $expectedFileData): void
109109
{
@@ -162,7 +162,7 @@ public function testWrite(array $configData, array $fileData, array $expectedFil
162162
* @param array $configData
163163
* @return void
164164
*
165-
* @dataProvider configDataProvider
165+
* @dataProvider writeErrorFileDataProvider
166166
*/
167167
public function testWriteErrorFile(array $configData): void
168168
{
@@ -195,10 +195,75 @@ public function testWriteEmptyReports(): void
195195
/**
196196
* @return array
197197
*/
198-
public function configDataProvider(): array
198+
public function writeDataProvider(): array
199+
{
200+
$configData = [
201+
'providers' => [
202+
[
203+
'name' => $this->providerName,
204+
'class' => $this->providerClass,
205+
'parameters' => [
206+
'name' => $this->reportName
207+
],
208+
]
209+
]
210+
];
211+
return [
212+
[
213+
'configData' => $configData,
214+
'fileData' => [
215+
['number' => 1, 'type' => 'Shoes\"" Usual\\\\"']
216+
],
217+
'expectedFileData' => [
218+
['number' => 1, 'type' => 'Shoes"" Usual"']
219+
]
220+
],
221+
[
222+
'configData' => $configData,
223+
'fileData' => [
224+
['number' => 1, 'type' => 'hello "World"']
225+
],
226+
'expectedFileData' => [
227+
['number' => 1, 'type' => 'hello "World"']
228+
]
229+
],
230+
[
231+
'configData' => $configData,
232+
'fileData' => [
233+
['number' => 1, 'type' => 'hello \"World\"']
234+
],
235+
'expectedFileData' => [
236+
['number' => 1, 'type' => 'hello "World"']
237+
]
238+
],
239+
[
240+
'configData' => $configData,
241+
'fileData' => [
242+
['number' => 1, 'type' => 'hello \\"World\\"']
243+
],
244+
'expectedFileData' => [
245+
['number' => 1, 'type' => 'hello "World"']
246+
]
247+
],
248+
[
249+
'configData' => $configData,
250+
'fileData' => [
251+
['number' => 1, 'type' => 'hello \\\"World\\\"']
252+
],
253+
'expectedFileData' => [
254+
['number' => 1, 'type' => 'hello "World"']
255+
]
256+
],
257+
];
258+
}
259+
260+
/**
261+
* @return array
262+
*/
263+
public function writeErrorFileDataProvider(): array
199264
{
200265
return [
201-
'reportProvider' => [
266+
[
202267
'configData' => [
203268
'providers' => [
204269
[
@@ -210,12 +275,6 @@ public function configDataProvider(): array
210275
]
211276
]
212277
],
213-
'fileData' => [
214-
['number' => 1, 'type' => 'Shoes\"" Usual\\\\"']
215-
],
216-
'expectedFileData' => [
217-
['number' => 1, 'type' => 'Shoes\"\" Usual\\"']
218-
]
219278
],
220279
];
221280
}

0 commit comments

Comments
 (0)