Skip to content

Handle extension activation for WP error or extension not found#146

Merged
schlessera merged 5 commits intowp-cli:masterfrom
abhijitrakas:fix/handle-ext-activation
Mar 30, 2019
Merged

Handle extension activation for WP error or extension not found#146
schlessera merged 5 commits intowp-cli:masterfrom
abhijitrakas:fix/handle-ext-activation

Conversation

@abhijitrakas
Copy link
Copy Markdown
Contributor

closes #127

Copy link
Copy Markdown
Member

@schlessera schlessera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @abhijitrakas!

Can you think of a way to write a test for this change so that we can verify its behavior and guard against regressions?


if ( $result ) {
// Check plugin is available or not.
$plugin = $this->fetcher->get_many( array( $slug ) );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could just as well be a theme here, so better use the term extension instead:

Suggested change
$plugin = $this->fetcher->get_many( array( $slug ) );
$extension = $this->fetcher->get_many( array( $slug ) );

// Check plugin is available or not.
$plugin = $this->fetcher->get_many( array( $slug ) );

if ( ! is_wp_error( $result ) && count( $plugin ) > 0 ) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( ! is_wp_error( $result ) && count( $plugin ) > 0 ) {
if ( ! is_wp_error( $result ) && count( $extension ) > 0 ) {

@abhijitrakas abhijitrakas requested a review from a team as a code owner March 30, 2019 10:18
@abhijitrakas
Copy link
Copy Markdown
Contributor Author

@schlessera PR Updated. Thanks.

@schlessera schlessera added command:plugin-install Related to 'plugin install' command command:theme-install Related to 'theme install' command labels Mar 30, 2019
@schlessera schlessera added this to the 2.0.4 milestone Mar 30, 2019
@schlessera
Copy link
Copy Markdown
Member

Thanks for the PR, @abhijitrakas !

@schlessera schlessera merged commit 5a0d2ce into wp-cli:master Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:plugin-install Related to 'plugin install' command command:theme-install Related to 'theme install' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command attempts to activate extension after its installation fails

2 participants