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

Wrap all uses of get_plugins() with the "all_plugins" filter #31

Merged
merged 4 commits into from Aug 18, 2017

Conversation

2 participants
@goldenapples
Contributor

goldenapples commented Aug 18, 2017

Uses the same filter used in the core list table at plugins.php, to ensure that plugin operations performed through wp-cli have the same effect as those done through the admin interface.

Includes some functional tests to ensure that if a plugin is hidden by a filter on "all_plugins":

  • it will not be displayed in the output of wp plugin list
  • it will not be activated by wp plugin activate --all
  • it will not be deactivated by wp plugin deactivate --all

Fixes #30

goldenapples added some commits Aug 18, 2017

Wrap all get_plugins() calls in all_plugins filter
Makes sure that the list of plugins available in WP-CLI matches the
output in wp-admin/plugins.php, by wrapping all get_plugins() calls in
the same filter which is used internally in wp-admin.
Add functional tests for all_plugins filter
Adds tests to ensure that if a plugin is hidden by a filter on
"all_plugins":

- it will not be displayed in the output of `wp plugin list`
- it will not be activated by `wp plugin activate --all`
- it will not be deactivated by `wp plugin deactivate --all`

@goldenapples goldenapples changed the title from Wrap all uses of get_plugins() in the all_plugins filter to Wrap all uses of get_plugins() with the "all_plugins" filter Aug 18, 2017

goldenapples added some commits Aug 18, 2017

Fix plugin-activate feature test scenario
A test for "plugin activate" shouldn't start with the plugins already
activated. This changes the scenario to start with the default WP
install, install an additional plugin, and then hide it using a filter.
Refactor plugin getters to a helper method
Since the same plugin getter code is being used in several different
places, it makes for easier reading to refactor it out to the helper
method Plugin_Command::get_all_plugins here.
/**
* Plugin Name: Handbook Functionality for Pages
/**
* Plugin Name: Handbook Functionality for Pages

This comment has been minimized.

@goldenapples

goldenapples Aug 18, 2017

Contributor

Not related to this PR, but there were a couple tabs in here I cleaned up.

@goldenapples

goldenapples Aug 18, 2017

Contributor

Not related to this PR, but there were a couple tabs in here I cleaned up.

@goldenapples

This comment has been minimized.

Show comment
Hide comment
@goldenapples

goldenapples Aug 18, 2017

Contributor

This is ready for review.

Contributor

goldenapples commented Aug 18, 2017

This is ready for review.

@danielbachhuber danielbachhuber added this to the 1.1.3 milestone Aug 18, 2017

@danielbachhuber danielbachhuber merged commit 5b57e08 into wp-cli:master Aug 18, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@goldenapples goldenapples deleted the goldenapples:30-use-all_plugins-filter branch Aug 18, 2017

@goldenapples

This comment has been minimized.

Show comment
Hide comment
@goldenapples

goldenapples Aug 18, 2017

Contributor

Thanks! 🎉

Contributor

goldenapples commented Aug 18, 2017

Thanks! 🎉

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