function DevelReinstallCommand::execute

File

src/Drush/Commands/DevelReinstallCommand.php, line 43

Class

DevelReinstallCommand
#[AsCommand(name: self::NAME, description: 'Uninstall, and Install modules.', aliases: [ 'dre', 'devel-reinstall', ])]

Namespace

Drupal\devel\Drush\Commands

Code

protected function execute(InputInterface $input, OutputInterface $output) : int {
  $modules = StringUtils::csvToArray($input->getArgument('modules'));
  $modules_str = implode(',', $modules);
  $options = Drush::redispatchOptions();
  $process = $this->processManager
    ->drush($this->siteAliasManager
    ->getSelf(), PmCommands::UNINSTALL, [
    $modules_str,
  ], $options);
  $process->mustRun();
  $process = $this->processManager
    ->drush($this->siteAliasManager
    ->getSelf(), PmCommands::INSTALL, [
    $modules_str,
  ], $options);
  $process->mustRun();
  (new DrushStyle($input, $output))->success(sprintf('%s reinstalled.', $modules_str));
  return Command::SUCCESS;
}