Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeployCommand.php
Go to the documentation of this file.
1 <?php
2 
8 
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Input\InputOption;
13 use Symfony\Component\Console\Output\OutputInterface;
14 use Composer\Downloader\VcsDownloader;
16 
21 class DeployCommand extends \Composer\Command\Command
22 {
23  protected function configure()
24  {
25  $this
26  ->setName('magento-module-deploy')
27  ->setDescription('Deploy all Magento modules loaded via composer.json')
28  ->setDefinition(array(
29  // we dont need to define verbose, because composer already defined it internal
30  //new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
31  ))
32  ->setHelp(<<<EOT
33 This command deploys all magento Modules
34 
35 EOT
36  )
37  ;
38  }
39 
40  protected function execute(InputInterface $input, OutputInterface $output)
41  {
42  // init repos
43  $composer = $this->getComposer();
44  $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
45 
46  $dm = $composer->getDownloadManager();
47  $im = $composer->getInstallationManager();
48 
52  $moduleInstaller = $im->getInstaller("magento-module");
53 
54 
55  $deployManager = new DeployManager( $this->getIO() );
56 
57  $extra = $composer->getPackage()->getExtra();
58  $sortPriority = isset($extra['magento-deploy-sort-priority']) ? $extra['magento-deploy-sort-priority'] : array();
59  $deployManager->setSortPriority( $sortPriority );
60 
61 
62 
63  $moduleInstaller->setDeployManager( $deployManager );
64 
65 
66  foreach ($installedRepo->getPackages() as $package) {
67 
68  if ($input->getOption('verbose')) {
69  $output->writeln( $package->getName() );
70  $output->writeln( $package->getType() );
71  }
72 
73  if( $package->getType() != "magento-module" ){
74  continue;
75  }
76  if ($input->getOption('verbose')) {
77  $output->writeln("package {$package->getName()} recognized");
78  }
79 
80  $strategy = $moduleInstaller->getDeployStrategy($package);
81  if ($input->getOption('verbose')) {
82  $output->writeln("used " . get_class($strategy) . " as deploy strategy");
83  }
84  $strategy->setMappings($moduleInstaller->getParser($package)->getMappings());
85 
86  $deployManagerEntry = new Entry();
87  $deployManagerEntry->setPackageName($package->getName());
88  $deployManagerEntry->setDeployStrategy($strategy);
89  $deployManager->addPackage($deployManagerEntry);
90 
91  }
92 
93  $deployManager->doDeploy();
94 
95  return;
96  }
97 }
Definition: Entry.php:12
if( $_orders &&count( $_orders))( 'Orders') ?></caption >< thead >< tr >< th scopeforeach( $_orders as $_order)(__( 'Order #')) ?>" class $extra
Definition: history.phtml:32