From c77e7d06ba4cfd7023b5aca434e7bcd9411fe6f1 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorbivskyi Date: Mon, 26 Jun 2023 13:24:21 -0700 Subject: [PATCH 1/2] MCLOUD-10736: Revert MCLOUD-10604 patch --- patches.json | 3 - ...ound_deployment_configuration__2.4.6.patch | 134 ------------------ 2 files changed, 137 deletions(-) delete mode 100644 patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch diff --git a/patches.json b/patches.json index c5044ac..68e0a85 100644 --- a/patches.json +++ b/patches.json @@ -271,9 +271,6 @@ "Fixes the error 'The file can't be deleted. Warning!unlink: No such file or directory' when flushing JS/CSS cache from the Admin": { ">=2.4.0 <2.4.1-p1": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch", ">=2.4.1-p1 <2.4.7": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch" - }, - "Reduced the number of times the same deployment configurations load": { - ">=2.4.6 <2.4.7": "MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch" } }, "magento/module-paypal": { diff --git a/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch b/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch deleted file mode 100644 index 0f63865..0000000 --- a/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch +++ /dev/null @@ -1,134 +0,0 @@ -diff -Nuar a/vendor/magento/framework/App/DeploymentConfig.php b/vendor/magento/framework/App/DeploymentConfig.php -index 6713baa3a1d..64f32d5516b 100644 ---- a/vendor/magento/framework/App/DeploymentConfig.php -+++ b/vendor/magento/framework/App/DeploymentConfig.php -@@ -51,6 +51,16 @@ class DeploymentConfig - */ - private $overrideData; - -+ /** -+ * @var array -+ */ -+ private $envOverrides = []; -+ -+ /** -+ * @var array -+ */ -+ private $readerLoad = []; -+ - /** - * Constructor - * -@@ -84,7 +94,9 @@ class DeploymentConfig - } - $result = $this->getByKey($key); - if ($result === null) { -- $this->reloadData(); -+ if (empty($this->flatData) || count($this->getAllEnvOverrides())) { -+ $this->reloadData(); -+ } - $result = $this->getByKey($key); - } - return $result ?? $defaultValue; -@@ -114,13 +126,13 @@ class DeploymentConfig - { - if ($key === null) { - if (empty($this->data)) { -- $this->reloadData(); -+ $this->reloadInitialData(); - } - return $this->data; - } - $result = $this->getConfigDataByKey($key); - if ($result === null) { -- $this->reloadData(); -+ $this->reloadInitialData(); - $result = $this->getConfigDataByKey($key); - } - return $result; -@@ -170,28 +182,55 @@ class DeploymentConfig - * @throws FileSystemException - * @throws RuntimeException - */ -- private function reloadData(): void -+ private function reloadInitialData(): void - { -+ if (empty($this->readerLoad) || empty($this->data) || empty($this->flatData)) { -+ $this->readerLoad = $this->reader->load(); -+ } - $this->data = array_replace( -- $this->reader->load(), -+ $this->readerLoad, - $this->overrideData ?? [], - $this->getEnvOverride() - ); -+ } -+ -+ /** -+ * Loads the configuration data -+ * -+ * @return void -+ * @throws FileSystemException -+ * @throws RuntimeException -+ */ -+ private function reloadData(): void -+ { -+ $this->reloadInitialData(); - // flatten data for config retrieval using get() - $this->flatData = $this->flattenParams($this->data); -+ $this->flatData = $this->getAllEnvOverrides() + $this->flatData; -+ } - -- // allow reading values from env variables by convention -- // MAGENTO_DC_{path}, like db/connection/default/host => -- // can be overwritten by MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST -- foreach (getenv() as $key => $value) { -- if (false !== \strpos($key, self::MAGENTO_ENV_PREFIX) -- && $key !== self::OVERRIDE_KEY -- ) { -- // convert MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST into db/connection/default/host -- $flatKey = strtolower(str_replace([self::MAGENTO_ENV_PREFIX, '__'], ['', '/'], $key)); -- $this->flatData[$flatKey] = $value; -+ /** -+ * Load all getenv() configs once -+ * -+ * @return array -+ */ -+ private function getAllEnvOverrides(): array -+ { -+ if (empty($this->envOverrides)) { -+ // allow reading values from env variables by convention -+ // MAGENTO_DC_{path}, like db/connection/default/host => -+ // can be overwritten by MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST -+ foreach (getenv() as $key => $value) { -+ if (false !== \strpos($key, self::MAGENTO_ENV_PREFIX) -+ && $key !== self::OVERRIDE_KEY -+ ) { -+ // convert MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST into db/connection/default/host -+ $flatKey = strtolower(str_replace([self::MAGENTO_ENV_PREFIX, '__'], ['', '/'], $key)); -+ $this->envOverrides[$flatKey] = $value; -+ } - } - } -+ return $this->envOverrides; - } - - /** -diff -Nuar a/vendor/magento/framework/Module/ModuleList.php b/vendor/magento/framework/Module/ModuleList.php -index b3cf433bbaf..32e2d2b1550 100644 ---- a/vendor/magento/framework/Module/ModuleList.php -+++ b/vendor/magento/framework/Module/ModuleList.php -@@ -140,8 +140,11 @@ class ModuleList implements ModuleListInterface - */ - private function loadConfigData() - { -- if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) { -- $this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES); -+ if (null === $this->configData) { -+ $config = $this->config->get(ConfigOptionsListConstants::KEY_MODULES); -+ if (null !== $config) { -+ $this->configData = $config; -+ } - } - } - } From 8a66555143d69cf11decbe93ea0bb4b34baa81f4 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Tue, 25 Jul 2023 17:31:01 -0500 Subject: [PATCH 2/2] MCLOUD-10863: Release MCP 1.0.23 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d5c7a7b..cbe8261 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/magento-cloud-patches", "description": "Provides critical fixes for Magento 2 Enterprise Edition", "type": "magento2-component", - "version": "1.0.22", + "version": "1.0.23", "license": "OSL-3.0", "repositories": { "repo.magento.com": {