Skip to content
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

Cloning a subsite using export/import --new_url affects the source subsite domain #67

Open
ppiotr3k opened this issue Nov 8, 2019 · 5 comments

Comments

@ppiotr3k
Copy link

ppiotr3k commented Nov 8, 2019

Describe the bug

When cloning a subsite in a multisite install using export/import, the source subsite domain is updated to the target subsite URL.

Steps to Reproduce

  1. wp mu-migration export all --blog_id=8 /tmp/blog_template.zip --themes --plugins --uploads
  2. wp mu-migration import all /tmp/blog_template.zip --new_url="https://mynew.url"
  3. blog_id=8 gets https://mynew.url as domain in DB

Expected behavior

source subsite is not affected by the creation of a new subsite when using export/import with --new_url

@nicholasio
Copy link
Member

nicholasio commented Nov 8, 2019

@ppiotr3k Are you importing the exported site in the same subsite? If so this is very likely an unhandled edge case, since when the search-replace takes place to replace the URL, it affects both subsites given they both have the same URL/Domain at the time search-replace is run and since search-replace is performed with the --network flag it catches both sites. You'd have the same issue if you didn't provide --new_url and tried to run search-replace afterwards with the --network flag.

We can probably solve this by restricting the search-replace to the imported subsite and handling the search-replace of the necessary global tables manually.

@ppiotr3k
Copy link
Author

@nicholasio I confirm this is an export/import in the same WordPress multisite deployment. The export/import features are used as a cloning operation, providing a new URL for the target during import.

Also, I haven't noticed previously, but indeed the URL is replaced in the source site in other places as well, with the target site URL, as explained in your possible cause analysis 👏

@jeffpaul jeffpaul added this to the Future Release milestone Feb 5, 2020
@jmtornetta
Copy link

Confirmed this is an issue for me as well.

@jmtornetta
Copy link

For others following, my workaround was to use wp-cli to change the site address to the "new site address" prior to exporting. Once the export is done, the script changes the site address back. Then, upon importing, you don't need to specify a new address.

I think I've mostly finished with the bash script, if anyone is interested lmk and I'll finish it up and provide.

@vdwijngaert
Copy link

I think I've mostly finished with the bash script, if anyone is interested lmk and I'll finish it up and provide.

Hey @jmtornetta, still got that script somewhere? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants