Blueprints: Rewrite wp-config.php to define constants in the defineWpConfigConsts step #902
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.
Summary
This PR enhances the defineWpConfigConsts step by allowing constants to be defined in two ways:
define()
before script execution (previous behavior)Related to #901
Related to WordPress/playground-tools#135
Closes #900
wp-config.php rewriting details
The following
wp-config.php
:When rewritten like this:
Will become:
Testing instructions
Go to the following URL without this PR applied and confirm there are warnings like Warning: Constant WP_DEBUG already defined:
http://localhost:5400/website-server/#{%22landingPage%22:%22/%22,%22phpExtensionBundles%22:[%22kitchen-sink%22],%22preferredVersions%22:{%22php%22:%228.0%22,%22wp%22:%225.9%22},%22steps%22:[{%22step%22:%22defineWpConfigConsts%22,%22consts%22:{%22WP_DEBUG%22:true}},{%22step%22:%22defineWpConfigConsts%22,%22consts%22:{%22WP_DEBUG_ONLY%22:%22a%22}}]}
Now go there with this PR applied and confirm the warnings are gone. The Blueprint encoded in the URL above calls the
defineWpConfigConsts
step twice just to make sure a duplicate and conflictingdefine()
call won't be added.cc @sejas