|
6 | 6 |
|
7 | 7 | namespace Magento\Setup\Console\Command;
|
8 | 8 |
|
9 |
| -use Magento\Framework\App\ObjectManager; |
10 |
| -use Magento\Framework\Filesystem\DriverInterface; |
11 |
| -use Magento\Framework\Filesystem\Io\File; |
12 |
| -use Symfony\Component\Console\Input\InputInterface; |
13 |
| -use Symfony\Component\Console\Output\OutputInterface; |
14 |
| -use Magento\Framework\Filesystem; |
15 |
| -use Magento\Framework\App\Filesystem\DirectoryList; |
16 | 9 | use Magento\Framework\App\DeploymentConfig;
|
| 10 | +use Magento\Framework\App\Filesystem\DirectoryList; |
| 11 | +use Magento\Framework\App\Interception\Cache\CompiledConfig; |
| 12 | +use Magento\Framework\App\ObjectManager; |
| 13 | +use Magento\Framework\App\ObjectManager\ConfigWriterInterface; |
17 | 14 | use Magento\Framework\Component\ComponentRegistrar;
|
18 | 15 | use Magento\Framework\Config\ConfigOptionsListConstants;
|
| 16 | +use Magento\Framework\Console\Cli; |
| 17 | +use Magento\Framework\Filesystem; |
| 18 | +use Magento\Framework\Filesystem\DriverInterface; |
| 19 | +use Magento\Framework\Filesystem\Io\File; |
19 | 20 | use Magento\Setup\Model\ObjectManagerProvider;
|
20 | 21 | use Magento\Setup\Module\Di\App\Task\Manager;
|
21 |
| -use Magento\Setup\Module\Di\App\Task\OperationFactory; |
22 | 22 | use Magento\Setup\Module\Di\App\Task\OperationException;
|
| 23 | +use Magento\Setup\Module\Di\App\Task\OperationFactory; |
23 | 24 | use Magento\Setup\Module\Di\App\Task\OperationInterface;
|
| 25 | +use Magento\Setup\Module\Di\Code\Generator\PluginList; |
| 26 | +use Magento\Setup\Module\Di\Code\Reader\ClassesScanner; |
| 27 | +use Magento\Setup\Module\Di\Compiler\Config\Chain\BackslashTrim; |
| 28 | +use Magento\Setup\Module\Di\Compiler\Config\Chain\InterceptorSubstitution; |
| 29 | +use Magento\Setup\Module\Di\Compiler\Config\Chain\PreferencesResolving; |
| 30 | +use Magento\Setup\Module\Di\Compiler\Config\ModificationChain; |
| 31 | +use Magento\Setup\Module\Di\Compiler\Log\Writer\Console; |
24 | 32 | use Symfony\Component\Console\Command\Command;
|
25 | 33 | use Symfony\Component\Console\Helper\ProgressBar;
|
26 |
| -use Magento\Framework\Console\Cli; |
| 34 | +use Symfony\Component\Console\Input\InputInterface; |
| 35 | +use Symfony\Component\Console\Output\OutputInterface; |
27 | 36 |
|
28 | 37 | /**
|
29 | 38 | * Command to run compile in single-tenant mode
|
@@ -156,20 +165,26 @@ protected function execute(InputInterface $input, OutputInterface $output)
|
156 | 165 | }
|
157 | 166 |
|
158 | 167 | $modulePaths = $this->componentRegistrar->getPaths(ComponentRegistrar::MODULE);
|
| 168 | + $moduleStatuses = $this->deploymentConfig->get(ConfigOptionsListConstants::KEY_MODULES); |
| 169 | + |
| 170 | + $modulePathsEnabled = array_filter($modulePaths, function ($path, $module) use ($moduleStatuses) { |
| 171 | + return ($moduleStatuses[$module] ?? 0) === 1; |
| 172 | + }, ARRAY_FILTER_USE_BOTH); |
| 173 | + |
159 | 174 | $libraryPaths = $this->componentRegistrar->getPaths(ComponentRegistrar::LIBRARY);
|
160 | 175 | $setupPath = $this->directoryList->getPath(DirectoryList::SETUP);
|
161 | 176 | $generationPath = $this->directoryList->getPath(DirectoryList::GENERATED_CODE);
|
162 | 177 |
|
163 | 178 | $this->objectManager->get(\Magento\Framework\App\Cache::class)->clean();
|
164 | 179 | $compiledPathsList = [
|
165 |
| - 'application' => $modulePaths, |
| 180 | + 'application' => $modulePathsEnabled, |
166 | 181 | 'library' => $libraryPaths,
|
167 | 182 | 'setup' => $setupPath,
|
168 | 183 | 'generated_helpers' => $generationPath
|
169 | 184 | ];
|
170 | 185 |
|
171 | 186 | $this->excludedPathsList = [
|
172 |
| - 'application' => $this->getExcludedModulePaths($modulePaths), |
| 187 | + 'application' => $this->getExcludedModulePaths($modulePathsEnabled), |
173 | 188 | 'framework' => $this->getExcludedLibraryPaths($libraryPaths),
|
174 | 189 | 'setup' => $this->getExcludedSetupPaths($setupPath),
|
175 | 190 | ];
|
@@ -207,11 +222,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
|
207 | 222 | $progressBar->display();
|
208 | 223 |
|
209 | 224 | $this->taskManager->process(
|
210 |
| - function (OperationInterface $operation) use ($progressBar) { |
| 225 | + function (OperationInterface $operation) use ($progressBar): void { |
211 | 226 | $progressBar->setMessage($operation->getName() . '...');
|
212 | 227 | $progressBar->display();
|
213 | 228 | },
|
214 |
| - function (OperationInterface $operation) use ($progressBar) { |
| 229 | + function (OperationInterface $operation) use ($progressBar): void { |
215 | 230 | $progressBar->advance();
|
216 | 231 | }
|
217 | 232 | );
|
@@ -327,39 +342,35 @@ private function configureObjectManager(OutputInterface $output)
|
327 | 342 | {
|
328 | 343 | $this->objectManager->configure(
|
329 | 344 | [
|
330 |
| - 'preferences' => [\Magento\Framework\App\ObjectManager\ConfigWriterInterface::class => |
331 |
| - \Magento\Framework\App\ObjectManager\ConfigWriter\Filesystem::class, |
332 |
| - ], \Magento\Setup\Module\Di\Compiler\Config\ModificationChain::class => [ |
| 345 | + 'preferences' => [ConfigWriterInterface::class => ObjectManager\ConfigWriter\Filesystem::class, |
| 346 | + ], ModificationChain::class => [ |
333 | 347 | 'arguments' => [
|
334 | 348 | 'modificationsList' => [
|
335 | 349 | 'BackslashTrim' => [
|
336 |
| - 'instance' => |
337 |
| - \Magento\Setup\Module\Di\Compiler\Config\Chain\BackslashTrim::class |
| 350 | + 'instance' => BackslashTrim::class |
338 | 351 | ],
|
339 | 352 | 'PreferencesResolving' => [
|
340 |
| - 'instance' => |
341 |
| - \Magento\Setup\Module\Di\Compiler\Config\Chain\PreferencesResolving::class |
| 353 | + 'instance' => PreferencesResolving::class |
342 | 354 | ],
|
343 | 355 | 'InterceptorSubstitution' => [
|
344 |
| - 'instance' => |
345 |
| - \Magento\Setup\Module\Di\Compiler\Config\Chain\InterceptorSubstitution::class |
| 356 | + 'instance' => InterceptorSubstitution::class |
346 | 357 | ],
|
347 | 358 | 'InterceptionPreferencesResolving' => [
|
348 |
| - 'instance' => \Magento\Setup\Module\Di\Compiler\Config\Chain\PreferencesResolving::class |
| 359 | + 'instance' => PreferencesResolving::class |
349 | 360 | ],
|
350 | 361 | ]
|
351 | 362 | ]
|
352 |
| - ], \Magento\Setup\Module\Di\Code\Generator\PluginList::class => [ |
| 363 | + ], PluginList::class => [ |
353 | 364 | 'arguments' => [
|
354 | 365 | 'cache' => [
|
355 |
| - 'instance' => \Magento\Framework\App\Interception\Cache\CompiledConfig::class |
| 366 | + 'instance' => CompiledConfig::class |
356 | 367 | ]
|
357 | 368 | ]
|
358 |
| - ], \Magento\Setup\Module\Di\Code\Reader\ClassesScanner::class => [ |
| 369 | + ], ClassesScanner::class => [ |
359 | 370 | 'arguments' => [
|
360 | 371 | 'excludePatterns' => $this->excludedPathsList
|
361 | 372 | ]
|
362 |
| - ], \Magento\Setup\Module\Di\Compiler\Log\Writer\Console::class => [ |
| 373 | + ], Console::class => [ |
363 | 374 | 'arguments' => [
|
364 | 375 | 'output' => $output,
|
365 | 376 | ]
|
|
0 commit comments