Skip to content

fix: wpdev golive accepts a bare host and validates the URL before copying the DB - #7

Open
derhofbauer wants to merge 1 commit into
mainfrom
fix/golive-accept-bare-host
Open

derhofbauer wants to merge 1 commit into
mainfrom
fix/golive-accept-bare-host

Conversation

@derhofbauer

Copy link
Copy Markdown
Member

Problem

ddev wpdev golive 'preview.inlingua.at' 6 failed with:

PHP Warning:  Undefined array key "host"
wpdev: ERROR: Could not parse 'preview.inlingua.at'.

parse_url() returns no host key for a scheme-less argument, so a bare
host was rejected. Worse, the URL was parsed after the golive database had
already been created, copied, and the local admin deleted — a bad URL left the
golive copy half-migrated (and ddev dbsync golive aborts before its
cleanup, leaving the copy behind).

Fix (commands/web/wpdev, cmd_golive)

  • Prepend https:// when the production URL has no scheme, so bare hosts work.
  • Parse and validate both URLs up front, before any data is touched.

Verification

Against a live project (inlingua-website):

  • ddev wpdev golive 'preview.inlingua.at' 6 now completes: devadmin deleted
    from the copy, 4488 posts reassigned to user 6, siteurl rewritten to
    https://preview.inlingua.at/, local db untouched.
  • ddev dbsync golive 'preview.inlingua.at' 6 produces the gzipped export in
    .ddev/.wpdev/ and drops the golive database afterwards.
  • bash -n passes; the diff is identical to the fix verified in the project.

…pying the DB

parse_url() has no host key for a scheme-less argument, so
'wpdev golive preview.inlingua.at 6' died with "Could not parse" after the
golive copy had already been created and the local admin deleted. Prepend
https:// when the scheme is missing, and parse/validate both URLs before
any data is touched.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant