Skip to content

Commit 745e757

Browse files
author
Oleksandr Gorkun
committed
MAGETWO-81469: Cached Config is Different From DB
1 parent 3001311 commit 745e757

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

app/code/Magento/Config/App/Config/Type/System.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function __construct(
121121
public function get($path = '')
122122
{
123123
if ($path === '') {
124-
$this->data = array_replace_recursive($this->loadAllData(), $this->data);
124+
$this->data = array_replace_recursive($this->data, $this->loadAllData());
125125

126126
return $this->data;
127127
}
@@ -142,7 +142,7 @@ private function getWithParts($path)
142142
if (count($pathParts) === 1 && $pathParts[0] !== ScopeInterface::SCOPE_DEFAULT) {
143143
if (!isset($this->data[$pathParts[0]])) {
144144
$data = $this->readData();
145-
$this->data = array_replace_recursive($data, $this->data);
145+
$this->data = $this->postProcessor->process($data);
146146
}
147147

148148
return $this->data[$pathParts[0]];
@@ -152,7 +152,7 @@ private function getWithParts($path)
152152

153153
if ($scopeType === ScopeInterface::SCOPE_DEFAULT) {
154154
if (!isset($this->data[$scopeType])) {
155-
$this->data = array_replace_recursive($this->loadDefaultScopeData($scopeType), $this->data);
155+
$this->data = array_replace_recursive($this->data, $this->loadDefaultScopeData($scopeType));
156156
}
157157

158158
return $this->getDataByPathParts($this->data[$scopeType], $pathParts);
@@ -162,10 +162,7 @@ private function getWithParts($path)
162162

163163
if (!isset($this->data[$scopeType][$scopeId])) {
164164
$scopeData = $this->loadScopeData($scopeType, $scopeId);
165-
166-
if (!isset($this->data[$scopeType][$scopeId])) {
167-
$this->data = array_replace_recursive($scopeData, $this->data);
168-
}
165+
$this->data = array_replace_recursive($this->data, $scopeData);
169166
}
170167

171168
return isset($this->data[$scopeType][$scopeId])
@@ -187,6 +184,7 @@ private function loadAllData()
187184
} else {
188185
$data = $this->serializer->unserialize($cachedData);
189186
}
187+
$data = $this->postProcessor->process($data);
190188

191189
return $data;
192190
}
@@ -207,6 +205,7 @@ private function loadDefaultScopeData($scopeType)
207205
} else {
208206
$data = [$scopeType => $this->serializer->unserialize($cachedData)];
209207
}
208+
$data = $this->postProcessor->process($data);
210209

211210
return $data;
212211
}
@@ -237,6 +236,7 @@ private function loadScopeData($scopeType, $scopeId)
237236
} else {
238237
$data = [$scopeType => [$scopeId => $this->serializer->unserialize($cachedData)]];
239238
}
239+
$data = $this->postProcessor->process($data);
240240

241241
return $data;
242242
}
@@ -308,9 +308,6 @@ private function getDataByPathParts($data, $pathParts)
308308
private function readData(): array
309309
{
310310
$this->data = $this->reader->read();
311-
$this->data = $this->postProcessor->process(
312-
$this->data
313-
);
314311

315312
return $this->data;
316313
}

0 commit comments

Comments
 (0)