Skip to content

Commit 8bd872b

Browse files
committed
Merge remote-tracking branch 'trigger/MC-33780-2' into web-api-pr
2 parents c0a35fa + 1bc5818 commit 8bd872b

File tree

1 file changed

+15
-0
lines changed
  • lib/internal/Magento/Framework/App/DeploymentConfig

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public function load($fileKey = null)
100100
if ($fileKey) {
101101
$filePath = $path . '/' . $this->configFilePool->getPath($fileKey);
102102
if ($fileDriver->isExists($filePath)) {
103+
$this->refreshCache($filePath);
103104
$result = include $filePath;
104105
if (!is_array($result)) {
105106
throw new RuntimeException(new Phrase("Invalid configuration file: '%1'", [$filePath]));
@@ -110,6 +111,7 @@ public function load($fileKey = null)
110111
foreach ($configFiles as $file) {
111112
$configFile = $path . '/' . $file;
112113
if ($fileDriver->isExists($configFile)) {
114+
$this->refreshCache($configFile);
113115
$fileData = include $configFile;
114116
if (!is_array($fileData)) {
115117
throw new RuntimeException(new Phrase("Invalid configuration file: '%1'", [$configFile]));
@@ -124,4 +126,17 @@ public function load($fileKey = null)
124126
}
125127
return $result ?: [];
126128
}
129+
130+
/**
131+
* Invalidate cache
132+
*
133+
* @param string $filePath
134+
*/
135+
private function refreshCache(string $filePath): void
136+
{
137+
if (function_exists('opcache_invalidate')
138+
&& filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
139+
opcache_invalidate($filePath);
140+
}
141+
}
127142
}

0 commit comments

Comments
 (0)