Skip to content

Commit 251eda1

Browse files
Merge branch '2.0.11' of github.com:magento/magento2ce into 2.0.11_bugs
2 parents e472e08 + 2de4597 commit 251eda1

File tree

3 files changed

+84
-18
lines changed

3 files changed

+84
-18
lines changed

app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<argument name="dataSource" xsi:type="object">Magento\Sales\Model\ResourceModel\Status\Collection</argument>
1616
<argument name="default_sort" xsi:type="string">state</argument>
1717
<argument name="default_dir" xsi:type="string">desc</argument>
18-
<argument name="pager_visibility" xsi:type="string">0</argument>
18+
<argument name="pager_visibility" xsi:type="string">1</argument>
1919
</arguments>
2020
<block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="sales_order_status.grid.columnSet">
2121
<arguments>

lib/internal/Magento/Framework/Module/Dir/Reader.php

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ class Reader
4646
*/
4747
protected $readFactory;
4848

49+
/**
50+
* Found configuration files grouped by configuration types (filename).
51+
*
52+
* @var array
53+
*/
54+
private $fileIterators = [];
55+
4956
/**
5057
* @param Dir $moduleDirs
5158
* @param ModuleListInterface $moduleList
@@ -65,24 +72,42 @@ public function __construct(
6572
}
6673

6774
/**
68-
* Go through all modules and find configuration files of active modules
75+
* Go through all modules and find configuration files of active modules.
6976
*
7077
* @param string $filename
7178
* @return FileIterator
7279
*/
7380
public function getConfigurationFiles($filename)
7481
{
75-
return $this->fileIteratorFactory->create($this->getFiles($filename, Dir::MODULE_ETC_DIR));
82+
return $this->getFilesIterator($filename, Dir::MODULE_ETC_DIR);
7683
}
7784

7885
/**
79-
* Go through all modules and find composer.json files of active modules
86+
* Go through all modules and find composer.json files of active modules.
8087
*
8188
* @return FileIterator
8289
*/
8390
public function getComposerJsonFiles()
8491
{
85-
return $this->fileIteratorFactory->create($this->getFiles('composer.json'));
92+
return $this->getFilesIterator('composer.json');
93+
}
94+
95+
/**
96+
* Retrieve iterator for files with $filename from components located in component $subDir.
97+
*
98+
* @param string $filename
99+
* @param string $subDir
100+
*
101+
* @return FileIterator
102+
*/
103+
private function getFilesIterator($filename, $subDir = '')
104+
{
105+
if (!isset($this->fileIterators[$subDir][$filename])) {
106+
$this->fileIterators[$subDir][$filename] = $this->fileIteratorFactory->create(
107+
$this->getFiles($filename, $subDir)
108+
);
109+
}
110+
return $this->fileIterators[$subDir][$filename];
86111
}
87112

88113
/**
@@ -96,9 +121,9 @@ private function getFiles($filename, $subDir = '')
96121
{
97122
$result = [];
98123
foreach ($this->modulesList->getNames() as $moduleName) {
99-
$moduleEtcDir = $this->getModuleDir($subDir, $moduleName);
100-
$file = $moduleEtcDir . '/' . $filename;
101-
$directoryRead = $this->readFactory->create($moduleEtcDir);
124+
$moduleSubDir = $this->getModuleDir($subDir, $moduleName);
125+
$file = $moduleSubDir . '/' . $filename;
126+
$directoryRead = $this->readFactory->create($moduleSubDir);
102127
$path = $directoryRead->getRelativePath($file);
103128
if ($directoryRead->isExist($path)) {
104129
$result[] = $file;
@@ -159,5 +184,6 @@ public function getModuleDir($type, $moduleName)
159184
public function setModuleDir($moduleName, $type, $path)
160185
{
161186
$this->customModuleDirs[$moduleName][$type] = $path;
187+
$this->fileIterators = [];
162188
}
163189
}

setup/src/Magento/Setup/Console/Command/DiCompileCommand.php

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
151151
'library' => $libraryPaths,
152152
'generated_helpers' => $generationPath
153153
];
154-
$excludedModulePaths = [];
155-
foreach ($modulePaths as $appCodePath) {
156-
$excludedModulePaths[] = '#^' . $appCodePath . '/Test#';
157-
}
158-
$excludedLibraryPaths = [];
159-
foreach ($libraryPaths as $libraryPath) {
160-
$excludedLibraryPaths[] = '#^' . $libraryPath . '/([\\w]+/)?Test#';
161-
}
162154
$this->excludedPathsList = [
163-
'application' => $excludedModulePaths,
164-
'framework' => $excludedLibraryPaths
155+
'application' => $this->getExcludedModulePaths($modulePaths),
156+
'framework' => $this->getExcludedLibraryPaths($libraryPaths),
165157
];
166158
$this->configureObjectManager($output);
167159

@@ -214,6 +206,54 @@ function (OperationInterface $operation) use ($progressBar) {
214206
}
215207
}
216208

209+
/**
210+
* Build list of module path regexps which should be excluded from compilation
211+
*
212+
* @param string[] $modulePaths
213+
* @return string[]
214+
*/
215+
private function getExcludedModulePaths(array $modulePaths)
216+
{
217+
$modulesByBasePath = [];
218+
foreach ($modulePaths as $modulePath) {
219+
$moduleDir = basename($modulePath);
220+
$vendorPath = dirname($modulePath);
221+
$vendorDir = basename($vendorPath);
222+
$basePath = dirname($vendorPath);
223+
$modulesByBasePath[$basePath][$vendorDir][] = $moduleDir;
224+
}
225+
226+
$basePathsRegExps = [];
227+
foreach ($modulesByBasePath as $basePath => $vendorPaths) {
228+
$vendorPathsRegExps = [];
229+
foreach ($vendorPaths as $vendorDir => $vendorModules) {
230+
$vendorPathsRegExps[] = $vendorDir
231+
. '/(?:' . join('|', $vendorModules) . ')';
232+
}
233+
$basePathsRegExps[] = $basePath
234+
. '/(?:' . join('|', $vendorPathsRegExps) . ')';
235+
}
236+
237+
$excludedModulePaths = [
238+
'#^(?:' . join('|', $basePathsRegExps) . ')/Test#',
239+
];
240+
return $excludedModulePaths;
241+
}
242+
243+
/**
244+
* Build list of library path regexps which should be excluded from compilation
245+
*
246+
* @param string[] $libraryPaths
247+
* @return string[]
248+
*/
249+
private function getExcludedLibraryPaths(array $libraryPaths)
250+
{
251+
$excludedLibraryPaths = [
252+
'#^(?:' . join('|', $libraryPaths) . ')/([\\w]+/)?Test#',
253+
];
254+
return $excludedLibraryPaths;
255+
}
256+
217257
/**
218258
* Delete directories by their code from "var" directory
219259
*

0 commit comments

Comments
 (0)