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

Abspath defined #4743

Merged
merged 5 commits into from Mar 31, 2018

Conversation

3 participants
@janw-oostendorp
Contributor

janw-oostendorp commented Mar 23, 2018

janw-oostendorp added some commits Mar 22, 2018

Check if ABSPATH constant is defined before defining ABSPATH
If a `wp-cli.yml` has a _require_ in which the ABSPATH is defined wp-cli command will throw a notice.
Example:

`wp-cli.yaml`

    require:
         - abspath.php

`abspath.php`

    <?php
    if ( ! defined( 'ABSPATH' ) ) {
	    define( 'ABSPATH', dirname( __FILE__ ) . '/custom_path/wp/' );
    }

When would you want this? In short symlinks, if you include WordPress in a symlink.

WordPress tries to define the ABSPATH it uses wp-load.php and if it's in a symlink it will define the path baed on the actual location. Not the symlink path.
That will give a problem if the wp-config.php is one directory above wp-load.php.
@danielbachhuber

👍 Looks good to my eyes. Thanks for including tests. I'll flag @schlessera for a second review.

@danielbachhuber danielbachhuber requested a review from schlessera Mar 30, 2018

@schlessera schlessera merged commit c1b431c into wp-cli:master Mar 31, 2018

1 check passed

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

This comment has been minimized.

Show comment
Hide comment
@schlessera

schlessera Mar 31, 2018

Member

Thanks for the PR, @janw-oostendorp !

Member

schlessera commented Mar 31, 2018

Thanks for the PR, @janw-oostendorp !

@janw-oostendorp janw-oostendorp deleted the janw-oostendorp:abspath-defined branch Apr 21, 2018

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