Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/internal/Magento/Framework/Module/Dir/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ class Reader
*/
protected $fileIteratorFactory;

/**
* Cache storage
*
* @var array
*/
protected $cache = [];

/**
* @param Dir $moduleDirs
* @param ModuleListInterface $moduleList
Expand All @@ -74,6 +81,9 @@ public function __construct(
*/
public function getConfigurationFiles($filename)
{
if (isset($this->cache[$filename])) {
return $this->cache[$filename];
}
$result = [];
foreach ($this->modulesList->getNames() as $moduleName) {
$file = $this->getModuleDir('etc', $moduleName) . '/' . $filename;
Expand All @@ -82,7 +92,7 @@ public function getConfigurationFiles($filename)
$result[] = $path;
}
}
return $this->fileIteratorFactory->create($this->modulesDirectory, $result);
return $this->cache[$filename] = $this->fileIteratorFactory->create($this->modulesDirectory, $result);
}

/**
Expand Down