Skip to content

Commit 732771d

Browse files
Merge pull request #434 from magento/develop
Merge develop into 2002.0
2 parents 4b26fd2 + 541eef8 commit 732771d

Some content is hidden

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

56 files changed

+1217
-736
lines changed

.travis.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,11 @@ addons:
1717
update: true
1818

1919
env:
20-
global:
21-
- DIR_TOOLS="/var/www/ece-tools"
2220
matrix:
2321
- TEST_SUITE=static-unit XDEBUG=true
2422
- TEST_SUITE=integration
2523
- TEST_SUITE=docker-integration
2624

27-
matrix:
28-
exclude:
29-
- php: '7.0'
30-
env: TEST_SUITE=docker-integration
31-
- php: '7.1'
32-
env: TEST_SUITE=docker-integration
33-
3425
cache:
3526
apt: true
3627
directories:
@@ -41,9 +32,7 @@ before_install:
4132
- echo "COMPOSER_MAGENTO_PASSWORD=${REPO_PASSWORD}" >> ./docker/composer.env
4233
- if [ $XDEBUG == "true" ]; then echo "PHP_ENABLE_XDEBUG=true" >> ./docker/global.env; fi;
4334

44-
install:
45-
- composer update -n --no-suggest
46-
- ./bin/ece-tools docker:build:integration ${TRAVIS_PHP_VERSION} 10.0 latest
35+
install: composer update -n --no-suggest
4736

4837
script: ./tests/travis/script.sh
4938

dist/.magento.env.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,25 @@
114114
# SCD_COMPRESSION_LEVEL - specifies which gzip compression level (0 to 9) to use when compressing static content; #
115115
# 0 disables compression. #
116116
# Magento Version: 2.1.4 and later #
117-
# Default value: 6 (build stage) or 4 (deploy stage) #
117+
# Default value: 6 (build stage) or 4 (deploy stage) #
118118
# Possible values: from 0 to 9 #
119119
# Stages: global, build and deploy #
120120
# Example: #
121121
# stage: #
122122
# deploy: #
123123
# SCD_COMPRESSION_LEVEL: 5 #
124124
#######################################################################################################################
125+
# SCD_COMPRESSION_TIMEOUT - determine in seconds maximum time for running static compression command #
126+
# by default this value is equal to 600 seconds. #
127+
# Magento Version: 2.1.4 and later #
128+
# Default value: 600 #
129+
# Possible values: > 0 #
130+
# Stages: global, build and deploy #
131+
# Example: #
132+
# stage: #
133+
# deploy: #
134+
# SCD_COMPRESSION_TIMEOUT: 800 #
135+
#######################################################################################################################
125136
# CLEAN_STATIC_FILES - cleans generated static files. By specifying the value of this configuration to 'false', #
126137
# you can leave the static files which were generated during the previous deployment. #
127138
# Magento Version: 2.1.4 and later #

patches.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@
145145
"2.1.5 - 2.1.12": "MAGECLOUD-2820__implement_isolated_connections_mechanism__2.1.5.patch",
146146
"2.1.13 - 2.1.17": "MAGECLOUD-2820__implement_isolated_connections_mechanism__2.1.13.patch",
147147
"2.2.0 - 2.2.8 || 2.3.0 - 2.3.1": "MAGECLOUD-2820__implement_isolated_connections_mechanism__2.2.0.patch"
148+
},
149+
"Pre-auth SQL": {
150+
"2.1.4 - 2.1.17": "MC-5964__preauth_sql__2.1.4.patch",
151+
"2.2.0 - 2.2.7": "MC-5964__preauth_sql__2.2.0.patch",
152+
"2.3.0": "MC-5964__preauth_sql__2.3.0.patch"
148153
}
149154
},
150155
"monolog/monolog": {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff -Naur a/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php b/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
2+
--- a/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
3+
+++ b/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
4+
@@ -2955,7 +2955,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
5+
if (isset($condition['to'])) {
6+
$query .= empty($query) ? '' : ' AND ';
7+
$to = $this->_prepareSqlDateCondition($condition, 'to');
8+
- $query = $this->_prepareQuotedSqlCondition($query . $conditionKeyMap['to'], $to, $fieldName);
9+
+ $query = $query . $this->_prepareQuotedSqlCondition($conditionKeyMap['to'], $to, $fieldName);
10+
}
11+
} elseif (array_key_exists($key, $conditionKeyMap)) {
12+
$value = $condition[$key];
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
diff -Naur a/vendor/magento/module-catalog/Model/Product/ProductFrontendAction/Synchronizer.php b/vendor/magento/module-catalog/Model/Product/ProductFrontendAction/Synchronizer.php
2+
--- a/vendor/magento/module-catalog/Model/Product/ProductFrontendAction/Synchronizer.php
3+
+++ b/vendor/magento/module-catalog/Model/Product/ProductFrontendAction/Synchronizer.php
4+
@@ -138,7 +138,9 @@ private function getProductIdsByActions(array $actions)
5+
$productIds = [];
6+
7+
foreach ($actions as $action) {
8+
- $productIds[] = $action['product_id'];
9+
+ if (isset($action['product_id']) && is_int($action['product_id'])) {
10+
+ $productIds[] = $action['product_id'];
11+
+ }
12+
}
13+
14+
return $productIds;
15+
@@ -159,33 +161,37 @@ public function syncActions(array $productsData, $typeId)
16+
$customerId = $this->session->getCustomerId();
17+
$visitorId = $this->visitor->getId();
18+
$collection = $this->getActionsByType($typeId);
19+
- $collection->addFieldToFilter('product_id', $this->getProductIdsByActions($productsData));
20+
-
21+
- /**
22+
- * Note that collection is also filtered by visitor id and customer id
23+
- * This collection shouldnt be flushed when visitor has products and then login
24+
- * It can remove only products for visitor, or only products for customer
25+
- *
26+
- * ['product_id' => 'added_at']
27+
- * @var ProductFrontendActionInterface $item
28+
- */
29+
- foreach ($collection as $item) {
30+
- $this->entityManager->delete($item);
31+
- }
32+
-
33+
- foreach ($productsData as $productId => $productData) {
34+
- /** @var ProductFrontendActionInterface $action */
35+
- $action = $this->productFrontendActionFactory->create([
36+
- 'data' => [
37+
- 'visitor_id' => $customerId ? null : $visitorId,
38+
- 'customer_id' => $this->session->getCustomerId(),
39+
- 'added_at' => $productData['added_at'],
40+
- 'product_id' => $productId,
41+
- 'type_id' => $typeId
42+
- ]
43+
- ]);
44+
-
45+
- $this->entityManager->save($action);
46+
+ $productIds = $this->getProductIdsByActions($productsData);
47+
+
48+
+ if ($productIds) {
49+
+ $collection->addFieldToFilter('product_id', $productIds);
50+
+
51+
+ /**
52+
+ * Note that collection is also filtered by visitor id and customer id
53+
+ * This collection shouldnt be flushed when visitor has products and then login
54+
+ * It can remove only products for visitor, or only products for customer
55+
+ *
56+
+ * ['product_id' => 'added_at']
57+
+ * @var ProductFrontendActionInterface $item
58+
+ */
59+
+ foreach ($collection as $item) {
60+
+ $this->entityManager->delete($item);
61+
+ }
62+
+
63+
+ foreach ($productsData as $productId => $productData) {
64+
+ /** @var ProductFrontendActionInterface $action */
65+
+ $action = $this->productFrontendActionFactory->create([
66+
+ 'data' => [
67+
+ 'visitor_id' => $customerId ? null : $visitorId,
68+
+ 'customer_id' => $this->session->getCustomerId(),
69+
+ 'added_at' => $productData['added_at'],
70+
+ 'product_id' => $productId,
71+
+ 'type_id' => $typeId
72+
+ ]
73+
+ ]);
74+
+
75+
+ $this->entityManager->save($action);
76+
+ }
77+
}
78+
}
79+
80+
diff -Naur a/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php b/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
81+
index 3d06e27542f0..a6c0dba6e175 100644
82+
--- a/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
83+
+++ b/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
84+
@@ -2904,7 +2904,7 @@ public function prepareSqlCondition($fieldName, $condition)
85+
if (isset($condition['to'])) {
86+
$query .= empty($query) ? '' : ' AND ';
87+
$to = $this->_prepareSqlDateCondition($condition, 'to');
88+
- $query = $this->_prepareQuotedSqlCondition($query . $conditionKeyMap['to'], $to, $fieldName);
89+
+ $query = $query . $this->_prepareQuotedSqlCondition($conditionKeyMap['to'], $to, $fieldName);
90+
}
91+
} elseif (array_key_exists($key, $conditionKeyMap)) {
92+
$value = $condition[$key];
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
diff -Naur a/vendor/magento/module-catalog/Model/Product/ProductFrontendAction/Synchronizer.php b/vendor/magento/module-catalog/Model/Product/ProductFrontendAction/Synchronizer.php
2+
--- a/vendor/magento/module-catalog/Model/Product/ProductFrontendAction/Synchronizer.php
3+
+++ b/vendor/magento/module-catalog/Model/Product/ProductFrontendAction/Synchronizer.php
4+
@@ -16,6 +16,8 @@
5+
use Magento\Framework\EntityManager\EntityManager;
6+
7+
/**
8+
+ * A Product Widget Synchronizer.
9+
+ *
10+
* Service which allows to sync product widget information, such as product id with db. In order to reuse this info
11+
* on different devices
12+
*/
13+
@@ -85,9 +87,10 @@ public function __construct(
14+
}
15+
16+
/**
17+
- * Find lifetime in configuration. Configuration is hold in Stores Configuration
18+
- * Also this configuration is generated by:
19+
- * @see \Magento\Catalog\Model\Widget\RecentlyViewedStorageConfiguration
20+
+ * Finds lifetime in configuration.
21+
+ *
22+
+ * Configuration is hold in Stores Configuration. Also this configuration is generated by
23+
+ * {@see Magento\Catalog\Model\Widget\RecentlyViewedStorageConfiguration}
24+
*
25+
* @param string $namespace
26+
* @return int
27+
@@ -108,6 +111,8 @@ private function getLifeTimeByNamespace($namespace)
28+
}
29+
30+
/**
31+
+ * Filters actions.
32+
+ *
33+
* In order to avoid suspicious actions, we need to filter them in DESC order, and slice only items that
34+
* can be persisted in database.
35+
*
36+
@@ -138,7 +143,9 @@ private function getProductIdsByActions(array $actions)
37+
$productIds = [];
38+
39+
foreach ($actions as $action) {
40+
- $productIds[] = $action['product_id'];
41+
+ if (isset($action['product_id']) && is_int($action['product_id'])) {
42+
+ $productIds[] = $action['product_id'];
43+
+ }
44+
}
45+
46+
return $productIds;
47+
@@ -159,33 +166,37 @@ public function syncActions(array $productsData, $typeId)
48+
$customerId = $this->session->getCustomerId();
49+
$visitorId = $this->visitor->getId();
50+
$collection = $this->getActionsByType($typeId);
51+
- $collection->addFieldToFilter('product_id', $this->getProductIdsByActions($productsData));
52+
-
53+
- /**
54+
- * Note that collection is also filtered by visitor id and customer id
55+
- * This collection shouldn't be flushed when visitor has products and then login
56+
- * It can remove only products for visitor, or only products for customer
57+
- *
58+
- * ['product_id' => 'added_at']
59+
- * @var ProductFrontendActionInterface $item
60+
- */
61+
- foreach ($collection as $item) {
62+
- $this->entityManager->delete($item);
63+
- }
64+
-
65+
- foreach ($productsData as $productId => $productData) {
66+
- /** @var ProductFrontendActionInterface $action */
67+
- $action = $this->productFrontendActionFactory->create([
68+
- 'data' => [
69+
- 'visitor_id' => $customerId ? null : $visitorId,
70+
- 'customer_id' => $this->session->getCustomerId(),
71+
- 'added_at' => $productData['added_at'],
72+
- 'product_id' => $productId,
73+
- 'type_id' => $typeId
74+
- ]
75+
- ]);
76+
-
77+
- $this->entityManager->save($action);
78+
+ $productIds = $this->getProductIdsByActions($productsData);
79+
+
80+
+ if ($productIds) {
81+
+ $collection->addFieldToFilter('product_id', $productIds);
82+
+
83+
+ /**
84+
+ * Note that collection is also filtered by visitor id and customer id
85+
+ * This collection shouldn't be flushed when visitor has products and then login
86+
+ * It can remove only products for visitor, or only products for customer
87+
+ *
88+
+ * ['product_id' => 'added_at']
89+
+ * @var ProductFrontendActionInterface $item
90+
+ */
91+
+ foreach ($collection as $item) {
92+
+ $this->entityManager->delete($item);
93+
+ }
94+
+
95+
+ foreach ($productsData as $productId => $productData) {
96+
+ /** @var ProductFrontendActionInterface $action */
97+
+ $action = $this->productFrontendActionFactory->create([
98+
+ 'data' => [
99+
+ 'visitor_id' => $customerId ? null : $visitorId,
100+
+ 'customer_id' => $this->session->getCustomerId(),
101+
+ 'added_at' => $productData['added_at'],
102+
+ 'product_id' => $productId,
103+
+ 'type_id' => $typeId
104+
+ ]
105+
+ ]);
106+
+
107+
+ $this->entityManager->save($action);
108+
+ }
109+
}
110+
}
111+
112+
diff -Naur a/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php b/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
113+
--- a/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
114+
+++ b/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
115+
@@ -2955,7 +2955,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
116+
if (isset($condition['to'])) {
117+
$query .= empty($query) ? '' : ' AND ';
118+
$to = $this->_prepareSqlDateCondition($condition, 'to');
119+
- $query = $this->_prepareQuotedSqlCondition($query . $conditionKeyMap['to'], $to, $fieldName);
120+
+ $query = $query . $this->_prepareQuotedSqlCondition($conditionKeyMap['to'], $to, $fieldName);
121+
}
122+
} elseif (array_key_exists($key, $conditionKeyMap)) {
123+
$value = $condition[$key];

src/App/Container.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\MagentoCloud\Command\PostDeploy;
1515
use Magento\MagentoCloud\Config\Database\ConfigInterface;
1616
use Magento\MagentoCloud\Config\Database\MergedConfig;
17+
use Magento\MagentoCloud\Config\Schema;
1718
use Magento\MagentoCloud\Config\Validator as ConfigValidator;
1819
use Magento\MagentoCloud\Config\ValidatorInterface;
1920
use Magento\MagentoCloud\Filesystem\DirectoryCopier;
@@ -64,6 +65,7 @@ public function __construct(string $toolsBasePath, string $magentoBasePath)
6465
/**
6566
* Binding.
6667
*/
68+
$this->container->singleton(Schema::class);
6769
$this->container->singleton(DirectoryList::class);
6870
$this->container->singleton(FileList::class);
6971
$this->container->singleton(DeployProcess\InstallUpdate\ConfigUpdate\SearchEngine::class);

src/Command/Dev/UpdateComposer/ClearModuleRequirements.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function generate(array $repos)
6262
\$composerJson = json_decode(file_get_contents(\$moduleDir . '/composer.json'), true);
6363
6464
foreach (\$composerJson['require'] as \$requireName => \$requireVersion) {
65-
if (strpos(\$requireName, 'magento/') !== false) {
65+
if (preg_match('{^(magento\/|elasticsearch\/)}i', \$requireName)) {
6666
unset(\$composerJson['require'][\$requireName]);
6767
}
6868
}

0 commit comments

Comments
 (0)