Skip to content

Commit 1d68134

Browse files
committed
MC-40111: Add support for Composer 2 for 2.3.7
--- fix flaky test
1 parent 60f7620 commit 1d68134

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]));
@@ -109,6 +110,7 @@ public function load($fileKey = null)
109110
$configFiles = $this->getFiles();
110111
foreach ($configFiles as $file) {
111112
$configFile = $path . '/' . $file;
113+
$this->refreshCache($configFile);
112114
if ($fileDriver->isExists($configFile)) {
113115
$fileData = include $configFile;
114116
if (!is_array($fileData)) {
@@ -141,4 +143,17 @@ public function loadConfigFile($fileKey, $pathConfig, $ignoreInitialConfigFiles
141143
{
142144
return $this->load($fileKey);
143145
}
146+
147+
/**
148+
* Invalidate cache
149+
*
150+
* @param string $filePath
151+
*/
152+
private function refreshCache(string $filePath): void
153+
{
154+
if (function_exists('opcache_invalidate')
155+
&& filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
156+
opcache_invalidate($filePath);
157+
}
158+
}
144159
}

0 commit comments

Comments
 (0)