Skip to content

Commit 3622772

Browse files
authored
Merge pull request #86 from magento-commerce/develop
MCLOUD-11149: MCP Release 1.0.24
2 parents 679b923 + bdb763c commit 3622772

3 files changed

+138
-1
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento-cloud-patches",
33
"description": "Provides critical fixes for Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "1.0.23",
5+
"version": "1.0.24",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {

patches.json

+3
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@
271271
"Fixes the error 'The file can't be deleted. Warning!unlink: No such file or directory' when flushing JS/CSS cache from the Admin": {
272272
">=2.4.0 <2.4.1-p1": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch",
273273
">=2.4.1-p1 <2.4.7": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch"
274+
},
275+
"Reduced the number of times the same deployment configurations load": {
276+
">=2.4.6 <2.4.6-p2": "MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch"
274277
}
275278
},
276279
"magento/module-paypal": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
diff -Nuar a/vendor/magento/framework/App/DeploymentConfig.php b/vendor/magento/framework/App/DeploymentConfig.php
2+
index 6713baa3a1d..64f32d5516b 100644
3+
--- a/vendor/magento/framework/App/DeploymentConfig.php
4+
+++ b/vendor/magento/framework/App/DeploymentConfig.php
5+
@@ -51,6 +51,16 @@ class DeploymentConfig
6+
*/
7+
private $overrideData;
8+
9+
+ /**
10+
+ * @var array
11+
+ */
12+
+ private $envOverrides = [];
13+
+
14+
+ /**
15+
+ * @var array
16+
+ */
17+
+ private $readerLoad = [];
18+
+
19+
/**
20+
* Constructor
21+
*
22+
@@ -84,7 +94,9 @@ class DeploymentConfig
23+
}
24+
$result = $this->getByKey($key);
25+
if ($result === null) {
26+
- $this->reloadData();
27+
+ if (empty($this->flatData) || count($this->getAllEnvOverrides())) {
28+
+ $this->reloadData();
29+
+ }
30+
$result = $this->getByKey($key);
31+
}
32+
return $result ?? $defaultValue;
33+
@@ -114,13 +126,13 @@ class DeploymentConfig
34+
{
35+
if ($key === null) {
36+
if (empty($this->data)) {
37+
- $this->reloadData();
38+
+ $this->reloadInitialData();
39+
}
40+
return $this->data;
41+
}
42+
$result = $this->getConfigDataByKey($key);
43+
if ($result === null) {
44+
- $this->reloadData();
45+
+ $this->reloadInitialData();
46+
$result = $this->getConfigDataByKey($key);
47+
}
48+
return $result;
49+
@@ -170,28 +182,55 @@ class DeploymentConfig
50+
* @throws FileSystemException
51+
* @throws RuntimeException
52+
*/
53+
- private function reloadData(): void
54+
+ private function reloadInitialData(): void
55+
{
56+
+ if (empty($this->readerLoad) || empty($this->data) || empty($this->flatData)) {
57+
+ $this->readerLoad = $this->reader->load();
58+
+ }
59+
$this->data = array_replace(
60+
- $this->reader->load(),
61+
+ $this->readerLoad,
62+
$this->overrideData ?? [],
63+
$this->getEnvOverride()
64+
);
65+
+ }
66+
+
67+
+ /**
68+
+ * Loads the configuration data
69+
+ *
70+
+ * @return void
71+
+ * @throws FileSystemException
72+
+ * @throws RuntimeException
73+
+ */
74+
+ private function reloadData(): void
75+
+ {
76+
+ $this->reloadInitialData();
77+
// flatten data for config retrieval using get()
78+
$this->flatData = $this->flattenParams($this->data);
79+
+ $this->flatData = $this->getAllEnvOverrides() + $this->flatData;
80+
+ }
81+
82+
- // allow reading values from env variables by convention
83+
- // MAGENTO_DC_{path}, like db/connection/default/host =>
84+
- // can be overwritten by MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST
85+
- foreach (getenv() as $key => $value) {
86+
- if (false !== \strpos($key, self::MAGENTO_ENV_PREFIX)
87+
- && $key !== self::OVERRIDE_KEY
88+
- ) {
89+
- // convert MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST into db/connection/default/host
90+
- $flatKey = strtolower(str_replace([self::MAGENTO_ENV_PREFIX, '__'], ['', '/'], $key));
91+
- $this->flatData[$flatKey] = $value;
92+
+ /**
93+
+ * Load all getenv() configs once
94+
+ *
95+
+ * @return array
96+
+ */
97+
+ private function getAllEnvOverrides(): array
98+
+ {
99+
+ if (empty($this->envOverrides)) {
100+
+ // allow reading values from env variables by convention
101+
+ // MAGENTO_DC_{path}, like db/connection/default/host =>
102+
+ // can be overwritten by MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST
103+
+ foreach (getenv() as $key => $value) {
104+
+ if (false !== \strpos($key, self::MAGENTO_ENV_PREFIX)
105+
+ && $key !== self::OVERRIDE_KEY
106+
+ ) {
107+
+ // convert MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST into db/connection/default/host
108+
+ $flatKey = strtolower(str_replace([self::MAGENTO_ENV_PREFIX, '__'], ['', '/'], $key));
109+
+ $this->envOverrides[$flatKey] = $value;
110+
+ }
111+
}
112+
}
113+
+ return $this->envOverrides;
114+
}
115+
116+
/**
117+
diff -Nuar a/vendor/magento/framework/Module/ModuleList.php b/vendor/magento/framework/Module/ModuleList.php
118+
index b3cf433bbaf..32e2d2b1550 100644
119+
--- a/vendor/magento/framework/Module/ModuleList.php
120+
+++ b/vendor/magento/framework/Module/ModuleList.php
121+
@@ -140,8 +140,11 @@ class ModuleList implements ModuleListInterface
122+
*/
123+
private function loadConfigData()
124+
{
125+
- if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) {
126+
- $this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES);
127+
+ if (null === $this->configData) {
128+
+ $config = $this->config->get(ConfigOptionsListConstants::KEY_MODULES);
129+
+ if (null !== $config) {
130+
+ $this->configData = $config;
131+
+ }
132+
}
133+
}
134+
}

0 commit comments

Comments
 (0)