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

Improve detection of WP-cli #12

Open
bobbingwide opened this issue Aug 29, 2016 · 2 comments
Open

Improve detection of WP-cli #12

bobbingwide opened this issue Aug 29, 2016 · 2 comments
Assignees

Comments

@bobbingwide
Copy link
Owner

When the oik-wp plugin is activated and the main plugin file is loaded under WP-cli then it needs better detection of the invoking file.

In my original wp.bat file, WP-cli was being invoked using:

cd \apache\htdocs\wordpress\wp-content\plugin\wp-cli\php
php boot-fs.php %*

In order to be able to run WP-cli against different installations I've changed this to specify the fully qualified file name.

php \apache\htdocs\wordpress\wp-content\plugin\wp-cli\php\boot-fs.php %* 

oik-wp needs to be able to detect that boot-fs.php is only part of the argv[0] paramater.

Change
if ( $_SERVER['argv'][0] == "boot-fs.php" ) {
to
if ( basename( $_SERVER['argv'][0] ) == "boot-fs.php" ) {

As this moment in time we don't expect to try running WP-cli under PHPUnit.

@bobbingwide
Copy link
Owner Author

Re-opening to cater for WP-cli being run as a phar.
Test for the WP_CLI constant before testing for top level file.
We might not need to check for the top level file.

@bobbingwide bobbingwide reopened this Feb 17, 2017
@bobbingwide
Copy link
Owner Author

This is now implemented, though the detection of PHP CLI is not protected against the problem documented in #19.

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

1 participant