Closed NateWr closed 8 years ago
Thanks for the report.
Can you tell me which version of wp-cli and WordPress you're using and the type of your multisite installation (subdomain or subdirectory).?
These SQL errors are coming from the create_new_site() method, when trying to install the newly created site.
The theme, plugins and uploads did't get transferred over due to an error on the update post_author routine, which couldn't find for some reason the mapping file and then exited the script execution. Can you check if there's a users_map.json in the mu-migration1461340848 dir?
Source and destination:
WP-CLI 0.23.0
WP 4.5
Source: Apache
Destination: Subdirectory multisite nginx
There's no users_map.json
in the mu-migration*
dir. I've got csv
, json
and sql
files named mu-migration-*<site_slug>.<ext>
.
I'm in the UK so clocking off for the day but do let me know if I can help provide any more diagnostic info or run any tests for you.
Ok, those SQL errors aren't the problem, they are harmless (but I'll fix them). Your only problem is that the import users routine didn't create a file required by the update_author method. How many users do you have in the single site? Were all of them transferred over?
There was just the one user. Our old friend admin
. :)
It looks like that user was not transferred over and it's caused some issues with the Author metabox on the Edit Post page. Luckily, none of the sites I'm working on now display author info so it's not really a big deal.
Thanks for the info @NateWr.
I know what went wrong and I'll work to patch this either today or over the weekend. You had this problem because no user had been transferred over (because there's also an admin user on your multisite install probably and thus no mapping table - the json file - had been created).
Hi @NateWr,
I have pushed a new version to master (which automatically goes to wp-cli package manager). Can you update to the latest version and try again?
The new version is 0.2.1 and you can check with: wp mu-migration info
(if you receive an error you're still on the old version).
Hey @NateWr were you able to test the new version?
Sorry @nicholasio, I've been away on a work trip the last week and I'm still getting caught up. I plan to run more migrations later this week or early next week and will definitely give you an update as soon as I can. I appreciate how quickly you responded to the report.
Hi @nicholasio, I updated mu-migration
and ran the export script again:
$ wp mu-migration export all ~/site.zip --plugins --themes --uploads
I took a look at the ~/site.zip
file and there's no users_map.json
file in it. Does that sound right? I haven't yet tried to import it (just about bedtime here) but I thought I'd check to see if that looked right to you.
That's correct, the users_map.json is created only when importing because it needs to know the new users ids.
Ok sorry for the noise. I'll let you know how the import goes.
Mostly smooth sailing. The import went great and very quickly. Here's the output:
crop@themeofthecrop-ubuntu-2gb-nyc3-01:/var/www/demo.themeofthecrop.com/htdocs$ wp mu-migration import all ~/plateup-site.zip --new_url=demo.themeofthecrop.com/plateup
Extracting zip package...
Importing tables...
WordPress database error Duplicate entry 'wp_4_user_roles' for key 'option_name' for query UPDATE `wp_4_options` SET `option_name` = 'wp_4_user_roles' WHERE `option_name` = 'wp_user_roles' made by include('phar:///usr/local/bin/wp/php/boot-phar.php'), include('phar:///usr/local/bin/wp/php/wp-cli.php'), WP_CLI\Runner->start, WP_CLI\Runner->_run_command, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, TenUp\MU_Migration\Commands\ImportCommand->all, TenUp\MU_Migration\Commands\ImportCommand->tables
Moving files...
Moving Plugins...
Moving export-bookings-for-rtb to plugins folder
Moving wpremote to plugins folder
Moving custom-fields-for-rtb to plugins folder
Moving akismet to plugins folder
Moving shepherd to plugins folder
Moving food-and-drink-menu-pro to plugins folder
Moving wordpress-seo to plugins folder
Moving mailchimp-for-rtb to plugins folder
Moving Uploads...
Moving Themes...
Moving twentyfifteen to themes folder
Importing Users...
Updating post_author...
Flushing rewrite rules...
Removing temporary files....
Success: All done, your new site is available at http://demo.themeofthecrop.com/plateup. Remember to flush the cache (memcache, redis etc).
I notice that when I look at Posts or Pages in the wp admin table lists, I see the author nate
. But when I open the Post or Page for editing, there's an empty author metabox (no select dropdown). This may be because the author ID is 1 in the source site, but the names/emails are different in the source/destination sites.
This is not a problem for my purposes, just a heads up. Thanks for the quick fix, this tool is amazing.
Thanks @NateWr for the heads up, Do you have any kind of caching on the sever? like Redis or Memcache? they can cause some inconsistencies like this after running the script, if so, try flushing the cache.
Anyway I'll take a look at this.
No caching running as far as I'm aware, however this is my first go on an nginx server and I used EasyEngine to get some initial things set up. So it's entirely possible there is something running that I'm unaware of. :)
Ok, I'm gonna close this out. If I find a bug with the users I'll open a separate issue.
This is a pretty cool tool, and even with the error I ran into saved me tons of time, thanks!
I ran the following on my single site:
Then moved the zip over to my new server where the multisite is set up and ran this:
It spit out a bunch of MySQL errors:
I may have made a mistake in that I didn't re-map the domain name when I ran the import command. When I realized, I popped into the
wp_blogs
table and updated the record there. The site then appeared in my list of sites, and from there it was fairly easy to run awp search-replace
command to update the URLs properly.However, none of my plugins, themes or files transferred over. I was able to work it all out by moving files from the
mu-migration146134970848
directory it created in my wp root.But I'm wondering if you have any idea what went wrong. I have two more sites to do in the coming weeks so would love to iron out any quirks with my setup if needed.
Thanks, this is a huge time saver for me!