Fix db-pull search-replace missing home-URL content - #238
Merged
Merged
Conversation
siteurl and home diverge on Bedrock (siteurl carries the /wp core subdirectory, home doesn't), but db-pull's search-replace was built from siteurl alone. Content — nav menus, post guids, the home option itself — is written against home, never siteurl, so the replace matched nothing there, exited 0, and the pulled site looked fine until someone clicked a menu link and landed back on production. Found on demo.imagewize.com after a --multisite pull: every subsite's block-based Navigation menu, and several post guids, still pointed at https://demo.imagewize.com/... even though wp_blogs.domain/ wp_site.domain (the #234 fix) were both already correct — this is a separate gap from that one. Both db-pull.sh and the db_pull MCP tool now read home for prod and dev alongside siteurl, and run a second search-replace pass against the home pair whenever it differs from the siteurl pair (always, on Bedrock; skipped on non-Bedrock installs where siteurl === home). A third pass replaces the http:// form of prod's home when prod is on https://. Content written before a site moved to HTTPS still links to http://example.com/..., which neither of the other passes matches — the manual fix on demo.imagewize.com needed both variants.
jasperf
force-pushed
the
fix/db-pull-home-url-search-replace
branch
from
September 19, 2026 09:09
40db4d4 to
46d01e8
Compare
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.
Summary
db-pull/db_pullbuilt its search-replace pair fromwp option get siteurlalone. On Bedrock,siteurlcarries the/wpcore subdirectory (https://example.com/wp) whilehomedoesn't (https://example.com) — and content (nav menus, postguids, thehomeoption itself) is written againsthome, neversiteurl. A search-replace keyed only onsiteurlmatched nothing in that content, exited 0, and the pulled site looked fine until someone clicked a menu link and landed back on production.Found on
demo.imagewize.comafter a--multisitepull: every subsite's block-based Navigation menu, and several postguids, still pointed athttps://demo.imagewize.com/...even thoughwp_blogs.domain/wp_site.domain(the #234 fix) were both already correct — this is a separate gap from that one, not a regression of it.Changes
scripts/backup/db-pull.sh— readshomealongsidesiteurlfor both prod and dev; runs a secondwp search-replacepass against thehomepair whenever it differs from thesiteurlpair, and a third against thehttp://form of the productionhomewhen production is onhttps://— pre-HTTPS content still links there, and neither other pass matches it. Both live in a new Step 6, inserted before the multisite domain fixup; later step numbers shift down by one.mcp-server/src/tools/dbPull.ts— same fix for thedb_pullMCP tool.DbPullResultgainsprodHome/devHome/homeSearchReplaceOutput/httpHomeSearchReplaceOutput.mcp-server/src/server.ts— tool reply now reports the home URLs and, for each extra pass that ran, its search-replace output.CHANGELOG.md— 5.24.4.Scope
The home pass is skipped when
home === siteurlfor both prod and dev — a harmless no-op on non-Bedrock installs, avoided to save a redundant full-table scan.Verification
bash -n scripts/backup/db-pull.sh— clean.npx tsc --noEmitinmcp-server/— clean, exit 0.go generate ./internal/catalog/...— no diff (this change touches script body only, not the@flag/@descmanifest header, so the generated catalog is unaffected).db-pull.shwith stubbedtrellis/ssh/wpfor a Bedrock HTTPS multisite and a non-Bedrock HTTP single site: the first issues all three search-replace passes with--url; the second skips both extra passes and keeps step numbers contiguous.demo.imagewize.comnetwork (network-widewp search-replacefor both thehttps://and bare-http://production-domain variants) and confirmed every subsite's Navigation menu now resolves to the local dev domain.