class DevelReinstallCommand

Attributes

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

Hierarchy

  • class \Drupal\devel\Drush\Commands\DevelReinstallCommand uses \Drush\Commands\AutowireTrait extends \Symfony\Component\Console\Command\Command

Expanded class hierarchy of DevelReinstallCommand

File

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

Namespace

Drupal\devel\Drush\Commands
View source
final class DevelReinstallCommand extends Command {
  use AutowireTrait;
  const NAME = 'devel:reinstall';
  public function __construct(private readonly SiteAliasManagerInterface $siteAliasManager, private readonly ProcessManager $processManager) {
    parent::__construct();
  }
  protected function configure() : void {
    $this->addArgument('modules', InputArgument::REQUIRED, 'A comma-separated list of module names.');
  }
  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;
  }

}

Members

Title Sort descending Modifiers Object type Summary
DevelReinstallCommand::configure protected function
DevelReinstallCommand::execute protected function
DevelReinstallCommand::NAME constant
DevelReinstallCommand::__construct public function