Ejemplo n.º 1
0
 protected function overwriteConfig(DrupalStyle $io, PreExistingConfigException $e, $moduleList, $overwriteConfig)
 {
     if ($overwriteConfig) {
         $io->info($this->trans('commands.module.install.messages.config-conflict-overwrite'));
     } else {
         $io->info($this->trans('commands.module.install.messages.config-conflict'));
     }
     $configObjects = $e->getConfigObjects();
     foreach (current($configObjects) as $config) {
         $io->info($config);
         $config = $this->getConfigFactory()->getEditable($config);
         $config->delete();
     }
     if (!$overwriteConfig) {
         return;
     }
     try {
         $moduleInstaller = $this->getModuleInstaller();
         $moduleInstaller->install($moduleList);
         $io->info(sprintf($this->trans('commands.module.install.messages.success'), implode(', ', $moduleList)));
     } catch (\Exception $e) {
         $io->error($e->getMessage());
         return;
     }
 }
Ejemplo n.º 2
0
 protected function overwriteConfig(PreExistingConfigException $e, $module_list, $modules, $dependencies, $overwrite_config, $output)
 {
     if ($overwrite_config) {
         $output->writeln('[+] <info>' . $this->trans('commands.module.install.messages.config-conflict-overwrite') . '</info>');
     } else {
         $output->writeln('[+] <info>' . $this->trans('commands.module.install.messages.config-conflict') . '</info>');
     }
     $configObjects = $e->getConfigObjects();
     foreach (current($configObjects) as $config) {
         $output->writeln('[-] <info>' . $config . '</info>');
         $config = $this->getConfigFactory()->getEditable($config);
         $config->delete();
     }
     if (!$overwrite_config) {
         return;
     }
     // Try to reinstall modules
     try {
         // Install the modules.
         $this->moduleInstaller->install($module_list);
         system_rebuild_module_data();
         $output->writeln('[+] <info>' . sprintf($this->trans('commands.module.install.messages.success'), implode(', ', array_merge($modules, $dependencies))) . '</info>');
     } catch (\Exception $e) {
         $output->writeln('[+] <error>' . $e->getMessage() . '</error>');
         return;
     }
 }