-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to list recently active plugins #383
Conversation
Add examples for activate and listing plugins with new flag Add tests for new flag
@wp-cli/committers Instead of |
@swissspidy I prefer |
@@ -0,0 +1,103 @@ | |||
Feature: List Recently Active WordPress plugins |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 805760d
src/Plugin_Command.php
Outdated
@@ -699,6 +705,12 @@ protected function get_item_list() { | |||
$auto_updates = []; | |||
} | |||
|
|||
$recently_active = is_multisite() ? get_site_option( 'recently_activated' ) : get_option( 'recently_activated' ); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes,
extension-command/src/Plugin_Command.php
Lines 443 to 453 in 7118325
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' ) | |
); | |
} |
@@ -1169,6 +1182,9 @@ public function delete( $args, $assoc_args = array() ) { | |||
* [--skip-update-check] | |||
* : 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/WP_CLI/CommandWithUpgrade.php
Outdated
@@ -501,6 +501,16 @@ protected function _list( $_, $assoc_args ) { | |||
|
|||
$all_items = $this->get_all_items(); | |||
|
|||
// Only show plugins that are recently active. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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 |
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! |
Fixes #232