Skip to content

Abspath defined#4743

Merged
schlessera merged 5 commits intowp-cli:masterfrom
janw-me:abspath-defined
Mar 31, 2018
Merged

Abspath defined#4743
schlessera merged 5 commits intowp-cli:masterfrom
janw-me:abspath-defined

Conversation

@janw-me
Copy link
Copy Markdown
Member

@janw-me janw-me commented Mar 23, 2018

Jan Willem Oostendorp added 4 commits March 22, 2018 13:07
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.
Copy link
Copy Markdown
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@schlessera schlessera merged commit c1b431c into wp-cli:master Mar 31, 2018
@schlessera
Copy link
Copy Markdown
Member

Thanks for the PR, @janw-oostendorp !

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants