Skip to content

Commit 4bda412

Browse files
author
Pascal Querner
committed
feat?: backend: show data from env
1 parent 49d4e75 commit 4bda412

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

app/code/core/Mage/Adminhtml/Model/Config/Data.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,13 @@ protected function _getPathConfig($path, $full = true)
349349
$config[$data->getPath()] = $data->getValue();
350350
}
351351
}
352+
353+
if (!$full) {
354+
/** @var Mage_Core_Helper_EnvironmentConfigLoader $environmentConfigLoaderHelper */
355+
$environmentConfigLoaderHelper = Mage::helper('core/environmentConfigLoader');
356+
$envConfig = $environmentConfigLoaderHelper->getAsArray($scope = $this->getScope());
357+
$config = array_merge($config, $envConfig);
358+
}
352359
return $config;
353360
}
354361

app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,42 @@ public function overrideEnvironment(Varien_Simplexml_Config $xmlConfig)
105105
}
106106
}
107107

108+
public function getAsArray(string $wantedScope): array
109+
{
110+
$env = $this->getEnv();
111+
$config = [];
112+
113+
foreach ($env as $configKey => $value) {
114+
if (!$this->isConfigKeyValid($configKey)) {
115+
continue;
116+
}
117+
118+
list($configKeyParts, $scope) = $this->getConfigKey($configKey);
119+
if (strtolower($scope) !== strtolower($wantedScope)) {
120+
continue;
121+
}
122+
123+
switch ($scope) {
124+
case static::CONFIG_KEY_DEFAULT:
125+
list($unused1, $unused2, $section, $group, $field) = $configKeyParts;
126+
$path = $this->buildPath($section, $group, $field);
127+
$config[$path] = $value;
128+
break;
129+
130+
case static::CONFIG_KEY_WEBSITES:
131+
case static::CONFIG_KEY_STORES:
132+
list($unused1, $unused2, $storeCode, $section, $group, $field) = $configKeyParts;
133+
$path = $this->buildPath($section, $group, $field);
134+
$storeCode = strtolower($storeCode);
135+
$scope = strtolower($scope);
136+
$config[$path] = $value;
137+
break;
138+
}
139+
}
140+
141+
return $config;
142+
}
143+
108144
/**
109145
* @internal method mostly for mocking
110146
*/

0 commit comments

Comments
 (0)