Skip to content
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

Ability to use as standalone WP-CLI Package #39

Open
dotsam opened this issue Feb 9, 2022 · 0 comments
Open

Ability to use as standalone WP-CLI Package #39

dotsam opened this issue Feb 9, 2022 · 0 comments

Comments

@dotsam
Copy link

dotsam commented Feb 9, 2022

This is the same request as I made a few years ago in #1, which at the time was closed because the official wp-cli "package index" wasn't accepting new submissions. Since then, they have decided to no longer maintain this separate index, and instead simply use any composer source, such as packagist, or a git repo directly.

I've taken a few minutes to see what changes are needed, and it breaks down like this:

  1. Any check for defined( 'ABSPATH' ) needs to be removed, or changed to check for defined( 'WP_CLI' ) as an alternative
  2. add_action isn't available in the wp-cli bootstrap process, so GF_CLI_Bootstrap::load_cli() should be called unconditionally
  3. For the same reason, GF_CLI_Bootstrap::load_addon() needs to be loaded differently or conditionally
  4. Similarly, plugin_dir_path() isn't available during bootstrap, but is easily replaced with dirname() (and rtrim() to be really clean)

With these changes made, I can use the plugin as a global wp-cli package without any further issues. The only other small niggle is that the type in the composer.json file isn't wp-cli-package as recommended, but this isn't a strict requirement.

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

No branches or pull requests

2 participants