[Blueprints] Use _SERVER['HTTPS'] in the import step #2802
Merged
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.
Motivation for the change, related issues
Importing WXR content with URL rewriting enabled replaces the protocol in some URLs from
httpstohttp.Implementation details
Sets
$_SERVER['HTTPS'] = "on"in theimportWxrBlueprint step. Thephp.run()method called in theimportWxrstep does not set it automatically – that's a role of the request handler. The WXR importer relies on theget_site_url()WordPress function, which weirdly takes thesite_urloption and replaces the protocol based on the$_SERVER['https']value.Testing Instructions (or ideally a Blueprint)
Import this WXR file via
?importWxrquery parameter and confirm all the URLs are https:https://gist.github.com/adamziel/a3d1a1941608e068e4b3d557ee2e8202/raw/aa659a130e1104cedeea8a63155a117dcb693dc8/tt25export.xml
The tricky part is, you need to serve Playground on a https url for this to work.
cc @bph