Skip to content

Commit

Permalink
Add optional flag to skip activating plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc45 committed Mar 10, 2024
1 parent 189b29b commit 56829b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Binary file modified qit
Binary file not shown.
5 changes: 5 additions & 0 deletions src/src/Commands/Environment/UpEnvironmentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ protected function configure() {
)
->addOption( 'volume', 'm', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, '(Optional) Additional volume mappings, eg: /home/mycomputer/my-plugin:/var/www/html/wp-content/plugins/my-plugin.', [] )
->addOption( 'php-ext', 'p', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'PHP extension to install in the environment.', [] )
->addOption( 'skip-activating-plugins', 's', InputOption::VALUE_NONE, 'Skip activating plugins in the environment.' )
->addOption( 'with-object-cache', 'o', InputOption::VALUE_NONE, '(Optional) Whether to enable Object Cache (Redis) in the environment.' )
->addOption( 'json', 'j', InputOption::VALUE_NEGATABLE, 'Whether to return raw JSON format.', false )
// ->addOption( 'attached', 'a', InputOption::VALUE_NONE, 'Whether to attach to the environment after starting it.' )
Expand Down Expand Up @@ -106,6 +107,10 @@ protected function execute( InputInterface $input, OutputInterface $output ): in
$this->e2e_environment->set_enable_object_cache( true );
}

if ( $input->getOption( 'skip-activating-plugins' ) ) {
$this->e2e_environment->set_skip_activating_plugins( true );
}

if ( $input->getOption( 'php-ext' ) ) {
$php_extensions = array_map( 'trim', $input->getOption( 'php-ext' ) );
foreach ( $php_extensions as $ext ) {
Expand Down
15 changes: 12 additions & 3 deletions src/src/Environment/Environments/E2EEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class E2EEnvironment extends Environment {
/** @var bool */
protected $enable_object_cache = false;

/** @var bool */
protected $skip_activating_plugins = false;

public function get_name(): string {
return 'e2e';
}
Expand Down Expand Up @@ -58,6 +61,10 @@ public function set_enable_object_cache( bool $enable_object_cache ): void {
$this->enable_object_cache = $enable_object_cache;
}

public function set_skip_activating_plugins( bool $skip_activating_plugins ): void {
$this->skip_activating_plugins = $skip_activating_plugins;
}

/**
* @param array<string> $php_extensions
*
Expand Down Expand Up @@ -107,9 +114,11 @@ protected function post_up( EnvInfo $env_info ): void {
] );

// Activate plugins.
$this->output->writeln( '<info>Activating plugins...</info>' );
$this->docker->run_inside_docker( $env_info, [ 'php', '/qit/bin/plugins-activate.php' ] );
$this->parse_php_activation_report( $env_info );
if ( ! $this->skip_activating_plugins ) {
$this->output->writeln( '<info>Activating plugins...</info>' );
$this->docker->run_inside_docker( $env_info, [ 'php', '/qit/bin/plugins-activate.php' ] );
$this->parse_php_activation_report( $env_info );
}

$env_info->php_version = $this->php_version;
$env_info->wordpress_version = $this->wordpress_version;
Expand Down

0 comments on commit 56829b7

Please sign in to comment.