Skip to content

Conversation

@thrijith
Copy link
Member

Fixes #232

Add examples for activate and listing plugins with new flag
Add tests for new flag
@thrijith thrijith requested a review from a team as a code owner November 13, 2023 07:47
@swissspidy
Copy link
Member

@wp-cli/committers Instead of wp plugin list --recently-active, should we just make this wp plugin list --status=recently-active?

@danielbachhuber
Copy link
Member

Instead of wp plugin list --recently-active, should we just make this wp plugin list --status=recently-active?

@swissspidy I prefer --recently-active because recently_active is a separate column, not a value in the status column.

@danielbachhuber danielbachhuber added command:plugin Related to 'plugin' command command:plugin-list Related to 'plugin list' command labels Nov 27, 2023
@@ -0,0 +1,103 @@
Feature: List Recently Active WordPress plugins
Copy link
Member

Choose a reason for hiding this comment

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

Can we rename this file to plugin-list-recently-active.feature?

Also, given we have a code path for multisite, we should have a multisite scenario too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in 805760d

$auto_updates = [];
}

$recently_active = is_multisite() ? get_site_option( 'recently_activated' ) : get_option( 'recently_activated' );
Copy link
Member

Choose a reason for hiding this comment

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

Is this get_site_option( 'recently_activated' ) option applied to single site plugin pages on multisite too? Or only the network plugins screen?

Copy link
Member Author

@thrijith thrijith Dec 3, 2023

Choose a reason for hiding this comment

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

yes,

if ( ! is_network_admin() ) {
update_option(
'recently_activated',
array( $plugin->file => time() ) + (array) get_option( 'recently_activated' )
);
} else {
update_site_option(
'recently_activated',
array( $plugin->file => time() ) + (array) get_site_option( 'recently_activated' )
);
}
I've updated condition to match what I found in deactivate.

* : If set, the plugin update check will be skipped.
*
* [--recently-active]
* : If set, only recently active plugins will be shown and the status filter will be ignored.
Copy link
Member

Choose a reason for hiding this comment

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

We should document how the behavior changes for multisite too.

Copy link
Member Author

Choose a reason for hiding this comment

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

@danielbachhuber sorry, didn't get what needs to be done here.


$all_items = $this->get_all_items();

// Only show plugins that are recently active.
Copy link
Member

Choose a reason for hiding this comment

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

This comment isn't necessary and can be removed. It simply duplicates the code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed in 805760d, but I didn't get what you meant here.

@thrijith
Copy link
Member Author

thrijith commented Dec 3, 2023

Not sure what the error is in https://github.com/wp-cli/extension-command/actions/runs/7077555679/job/19262025024?pr=383#step:12:260, unable to replicate on local site, getting this error only in tests, please check https://cleanshot.thrijith.com/jMsCpCyk

@danielbachhuber
Copy link
Member

@thrijith You can merge main to fix the unrelated broken tests. I fixed them up with #389.

I'd recommend setting up the Behat test suite locally so it's easier for you to debug the failure specific to your tests.

@thrijith
Copy link
Member Author

thrijith commented Mar 1, 2024

Closing the PR as I was not able to figure out the reason for one of the failure in tests, anyone who wants to takes this, please feel free to do so, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:plugin Related to 'plugin' command command:plugin-list Related to 'plugin list' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to activate all recently active plugins

3 participants