예제 #1
0
 /**
  * Installation modules.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param array $modules
  * @throws BitrixException
  * @throws \LogicException
  * @throws ModuleException
  */
 protected function configureModules(InputInterface $input, OutputInterface $output, array $modules)
 {
     $app = $this->getApplication();
     if ($app->getConfiguration()) {
         $app->addCommands(ModuleCommand::getCommands());
         if ($app->getBitrixStatus() != \Notamedia\ConsoleJedi\Application\Application::BITRIX_STATUS_COMPLETE) {
             throw new BitrixException('Bitrix core is not available');
         }
     } else {
         throw new BitrixException('No configuration loaded');
     }
     if (!is_array($modules)) {
         throw new \LogicException('Incorrect modules configuration');
     }
     if (!count($modules)) {
         return;
     }
     $bar = new ProgressBar($output, count($modules));
     $bar->setRedrawFrequency(1);
     $bar->setFormat('verbose');
     foreach ($modules as $moduleName) {
         $message = "\r" . '   module:load ' . $moduleName . ': ';
         try {
             if (isset($bar)) {
                 $bar->setMessage($message);
                 $bar->display();
             }
             (new Module($moduleName))->load()->register();
             $bar->clear();
             $output->writeln($message . '<info>ok</info>');
         } catch (ModuleInstallException $e) {
             $bar->clear();
             $output->writeln($e->getMessage(), OutputInterface::VERBOSITY_VERBOSE);
             $output->writeln($message . '<comment>not registered</comment> (install it in admin panel)');
         } catch (ModuleException $e) {
             $bar->clear();
             $output->writeln($e->getMessage(), OutputInterface::VERBOSITY_VERBOSE);
             $output->writeln($message . '<error>FAILED</error>');
         }
         $bar->advance();
     }
     $bar->finish();
     $bar->clear();
     $output->write("\r");
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     parent::configure();
     $this->setName('module:load')->setDescription('Load and install module from Marketplace')->addOption('no-update', 'nu', InputOption::VALUE_NONE, 'Don\' update module')->addOption('no-register', 'ni', InputOption::VALUE_NONE, 'Load only, don\' register module')->addOption('beta', 'b', InputOption::VALUE_NONE, 'Allow the installation of beta releases');
 }
예제 #3
0
 /**
  * Gets Bitrix console commands from this package.
  *
  * @return Command[]
  */
 protected function getBitrixCommands()
 {
     return array_merge([new OnCronCommand(), new ExecuteCommand(), new ClearCommand(), new InitCommand(), new ReIndexCommand()], Module\ModuleCommand::getCommands());
 }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     parent::configure();
     $this->setName('module:update')->setDescription('Load module updates from Marketplace')->addOption('beta', 'b', InputOption::VALUE_NONE, 'Allow the installation of beta releases');
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     parent::configure();
     $this->setName('module:unregister')->setDescription('Uninstall module');
 }
예제 #6
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     parent::configure();
     $this->setName('module:remove')->setDescription('Uninstall and remove module folder from system');
 }