-
Notifications
You must be signed in to change notification settings - Fork 677
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
[BUGS-7678] WP config HTTP_HOST documentation updates #8969
Conversation
this matches what we're putting into the mu-plugin
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jazzsequence could we do something in a plugin that made copy/pasting a big switch
statement unnecessary? That might be too big a request for this PR.
I would love to see a version of this automated as part of the site launch workflow for wpms sites |
the fundamental ask here is that there needs to be a fallback domain that is customer-specific and not reliant on server variables. We could simplify this somewhat and remove the switch, but there's every chance that it will break things because we have different environments that need different rules (and using Ultimately, the configuration file (be it |
whether or not the full superglobal is available is somewhat irrelevant, we can just talk about the value we actually care about, which is HTTP_HOST
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
What about hiding some of this complexity in |
The problem is this is in the mu-plugin. Specifically, it's in the instructions for setting up WordPress multisite that displays in the admin when you are setting up a multisite. We are making a change in the MU Plugin already with pantheon-systems/pantheon-mu-plugin#42. This PR is updating our documentation so it matches the guidance that's already in the mu-plugin. This is something that people are already copy/pasting. |
MU plugins are loaded after HOWEVER, it is conceivable that we could define a constant in Pantheon-maintained code (would exist in the WordPress upstream) if ( ! defined( 'PANTHEON_HOSTNAME' ) ) {
$site_name = $_ENV['PANTHEON_SITE_NAME'];
$hostname = ! isset( $_SERVER['HTTP_HOST'] ) ? $_ENV['PANTHEON_ENVIRONMENT'] . "-$site_name.pantheonsite.io" : $_SERVER['HTTP_HOST'];
define( 'PANTHEON_HOSTNAME', $hostname );
} This would be the customer code (default): define('DOMAIN_CURRENT_SITE', PANTHEON_HOSTNAME); However, they could customize it like this if they wanted: define( 'PANTHEON_HOSTNAME', [
'dev' => 'pantheondev.chrisreynolds.io',
'test' => 'pantheontest.chrisreynolds.io',
'live' => 'pantheon.chrisreynolds.io',
] );
$hostname = isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : PANTHEON_HOSTNAME[ $_ENV['PANTHEON_ENVIRONMENT'] ];
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', $hostname);
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1); This is a change in the approach because we'd need to make upstream changes, so this is a @scottbuscemi Product decision. |
Discussed in PBR. We're going to try the alternative approach I outline in my last comment. tl:dr; this will mean essentially one (optional) change to the customer's |
rethinking the approach, moving docs PR back to draft
Thanks @jazzsequence! |
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
if `$_ENV['PANTHEON_ENVIRONMENT']` is unset (e.g. in non-Lando local development environments), using PANTHEON_HOSTNAME will fatal as undefined, so we still need a fallback here.
⚡ Deployed with Pantheon Decoupled This build was successfully deployed with Pantheon. You can track the build logs here. 👀 Preview: https://pr-8969-documentation.appa.pantheon.site |
We've merged everything, but we're going to hold off on releasing docs until the next WordPress update goes out and pushes the https://github.com/pantheon-systems/WordPress upstream update out with it. Release note will be updated at that time for WordPress update. |
Summary
Undefined array key HTTP_HOST
warning as a known issuePANTHEON_HOSTNAME
PANTHEON_HOSTNAME
constantRemaining Work and Prerequisites
PANTHEON_HOSTNAME
constant pantheon-mu-plugin#42 is mergedRelease:
Post Launch
Do not remove - To be completed by the docs team upon merge:
/old-path/
=>/new-path/
(if applicable)