Repository navigation
Conversation
…er HTTP WordPress is installed with https:// URLs before the certificate step. When that step fails, site-command now keeps the site on plain HTTP, but WordPress kept redirecting visitors and wp-admin to HTTPS, which isn't served. The same happens while a manual DNS-01 challenge waits for `ee site ssl-verify`. After www_ssl_wrapper(), a create whose site isn't served over HTTPS switches the URLs back to http (search-replace, with --network for multisite). `update --ssl=le` still switches them to https when it issues the certificate, but no longer while a manual DNS-01 challenge is pending; site-command's new site_scheme_changed() hook switches them once ssl-verify issues the certificate. With an older site-command, only the failed create is handled. The search-replace of update_ssl() moves into replace_url_scheme(), which now warns instead of reporting success when it fails.
There was a problem hiding this comment.
🟡 Changes recommended
The new scheme-change hook leaves subdomain multisite URLs on HTTP when subsites are created before certificate verification.
1 open issue
What changed in this PR
Keeps WordPress URLs aligned with the site's HTTP or HTTPS state, complementing EasyEngine/site-command#521 when certificate issuance fails or remains pending.
Changes:
- Restores HTTP URLs after creation when HTTPS is unavailable.
- Adds a scheme-change hook to update URLs when certificate verification enables HTTPS.
- Centralizes URL replacement and backup handling, and warns when replacement fails.
| File | Description |
|---|---|
src/WordPress.php |
Coordinates WordPress URL schemes with certificate state and shares backup and replacement logic. |
Review effort: Balanced
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.

Pairs with EasyEngine/site-command#521 and should ship in the same release.
Problem
WordPress is installed with
https://URLs (wp core install --url=https://<site>) before the certificate step. When that step can't issue the certificate, site-command#521 keeps the site on plain HTTP, but WordPress kepthome/siteurlon https. Visitors and wp-admin were redirected to HTTPS, which isn't served for the site. The same happens while a manual DNS-01 challenge (no Cloudflare API key) waits foree site ssl-verify.Changes
www_ssl_wrapper()in the create flow (run_ssl_step()), if WordPress was installed with https URLs but the site isn't served over HTTPS (site-command clearedsite_ssl, or a Let's Encrypt certificate is still pending), the URLs are switched back to http withwp search-replace https://<site> http://<site> --precise(--networkfor multisite). A fresh install needs no DB backup.--skip-installsites are skipped.update --ssl=lestill switches the URLs to https when it issues the certificate. While a manual DNS-01 challenge is pending it leaves them on http, and the newsite_scheme_changed()override switches them once site-command turns HTTPS on (standalonessl-verify, or a renewal or alias update that issues the first certificate). It does nothing on a site without WordPress installed.update_ssl()move toreplace_url_scheme(), with the same output. A failed search-replace now warns and names the command to run, instead of reporting success.function_exists()guards the new helper.Testing
--network; nothing is switched for an issued certificate, self-signed SSL, a site installed on http or--skip-install;update --ssl=leswitches to https with a backup, and not while pending;site_scheme_changed('https')switches with a backup and skips a site without WordPress installed; a failed search-replace warns. 11 of the 12 new tests fail ondevelop; the rest of the suite is unchanged.home/siteurlare http and the site answers 200 over HTTP; afterupdate --ssl=lethe certificate covers www,home/siteurlare https, http redirects to https;update --ssl=lepoints to ssl-verify; after the TXT records are published,ssl-verifyturns HTTPS on, adds the HTTPS www redirect and switches the URLs to https;