Skip to content

Commit 34601c7

Browse files
alzotao-iegorov
authored andcommitted
ACP2E-1958: avoid reloading configs for each requested key; added unit tests
1 parent 81dc33e commit 34601c7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/internal/Magento/Framework/App/DeploymentConfig.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public function __construct(DeploymentConfig\Reader $reader, $overrideData = [])
8686
*/
8787
public function get($key = null, $defaultValue = null)
8888
{
89-
//if no key is requested, then all config is returned.
9089
if ($key === null) {
9190
if (empty($this->flatData)) {
9291
$this->reloadData();
@@ -211,6 +210,8 @@ private function reloadData(): void
211210
}
212211

213212
/**
213+
* Load all getenv() configs once
214+
*
214215
* @return array
215216
*/
216217
private function getAllEnvOverrides(): array

lib/internal/Magento/Framework/Module/ModuleList.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,9 @@ public function isModuleInfoAvailable()
140140
*/
141141
private function loadConfigData()
142142
{
143-
if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) {
144-
$this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES);
143+
$config = $this->config->get(ConfigOptionsListConstants::KEY_MODULES);
144+
if (null === $this->configData && null !== $config) {
145+
$this->configData = $config;
145146
}
146147
}
147148

0 commit comments

Comments
 (0)