This WP-CLI plugin makes the process of moving sites from single WordPress sites to a Multisite instance (or vice-versa) much easier. It exports everything into a zip package which can be used to automatically import it within the desired Multisite installation.
MIT License
329
stars
47
forks
source link
Importing site does not completely rewrite table data. #57
We have a blog that is part of a multisite that I exported, and the export went fine.
When I imported the site into a different multisite install on another server, setting a specific blog_id and new_url option, it did not correctly complete the rewrite, and did not add the site to the wp_blogs table correctly. The intent was to keep the same blog_id, and that there was no blog with this ID on the destination multisite install. Here is the command run (with URL made generic):
user@my-website:/var/www/html$ wp mu-migration import all ~/subsite-2.zip --new_url=my-website.com/program1 --blog_id=2
Extracting zip package...
Importing tables...
Moving files...
Moving Uploads...
Importing Users...
PHP Notice: Trying to get property 'domain' of non-object in /home/ubuntu/.wp-cli/packages/vendor/10up/mu-migration/includes/helpers.php on line 176
Notice: Trying to get property 'domain' of non-object in /home/ubuntu/.wp-cli/packages/vendor/10up/mu-migration/includes/helpers.php on line 176
[316] Updating posts authors 100% [============================================================================================================================] 0:27 / 0:26Flushing rewrite rules...
Removing temporary files....
Success: All done, your new site is available at http://my-website.com/program1. Remember to flush the cache (memcache, redis etc).
Please note the two PHP Notices, not sure if this affected the import or not. Also, I specified the blog_id in the command run, but there was no existing blog with that ID; not sure if this affected the process or not.
After the import, I can see that the content was correctly set up in the various wp_2_* tables, but it was not added to the wp_blogs table:
Is there a step that I'm missing? Does exporting from a Multisite install, and then importing into another Multisite install with this tool work correctly?
Or is it simply the case that if the blog_id option is used, but an existing site does not exist, it will not properly import? If this is so, then it would be useful to halt execution instead of creating all of the tables that will not properly function.
The blog_id option for importing is meant to be used only when overriding existing subsites. If you're just importing as a new site you just need to specify the --new_url option.
Running:
PHP 7.2.10 WP-CLI 2.0.0-alpha-d0fe445
We have a blog that is part of a multisite that I exported, and the export went fine.
When I imported the site into a different multisite install on another server, setting a specific
blog_id
andnew_url
option, it did not correctly complete the rewrite, and did not add the site to thewp_blogs
table correctly. The intent was to keep the sameblog_id
, and that there was no blog with this ID on the destination multisite install. Here is the command run (with URL made generic):Please note the two PHP Notices, not sure if this affected the import or not. Also, I specified the
blog_id
in the command run, but there was no existing blog with that ID; not sure if this affected the process or not.After the import, I can see that the content was correctly set up in the various
wp_2_*
tables, but it was not added to thewp_blogs
table:Additionally, checking the
wp_2_options
table shows that none of the existing URL strings were rewritten during the import.Is there a step that I'm missing? Does exporting from a Multisite install, and then importing into another Multisite install with this tool work correctly?
Or is it simply the case that if the
blog_id
option is used, but an existing site does not exist, it will not properly import? If this is so, then it would be useful to halt execution instead of creating all of the tables that will not properly function.