Check if ABSPATH constant is defined before defining ABSPATH#4537
Closed
janw-me wants to merge 1 commit intowp-cli:masterfrom
Closed
Check if ABSPATH constant is defined before defining ABSPATH#4537janw-me wants to merge 1 commit intowp-cli:masterfrom
janw-me wants to merge 1 commit intowp-cli:masterfrom
Conversation
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.
Member
|
@janw-oostendorp Please open an issue for discussion on substantial changes like this, thanks. |
Member
Author
|
Check; PS It might be a bit hard to explain. But the fix is a simple check which I highly doubt would give problems. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a
wp-cli.ymlhas a require in which the ABSPATH is defined wp-cli command will throw a notice.Example:
wp-cli.yamlabspath.phpWhen 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.