10up / MU-Migration

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

Migration hanging when importing users #88

Closed anekola closed 3 years ago

anekola commented 3 years ago

Describe your question I'm not sure if this is a bug or if I'm doing something wrong, because this seems rather basic. I did one site import with a few dozen users that worked fine, but now that I'm attempting one for sites with hundreds to thousands of users the import keeps hanging while "Importing Users."

On one of the larger site, it returns a few PHP errors while doing so:

PHP Warning: array_combine(): Both parameters should have an equal number of elements in /home/vagrant/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-import.php on line 90
Warning: array_combine(): Both parameters should have an equal number of elements in /home/vagrant/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-import.php on line 90
PHP Warning: array_diff_assoc(): Argument #1 is not an array in /home/vagrant/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-import.php on line 118
Warning: array_diff_assoc(): Argument #1 is not an array in /home/vagrant/.wp-cli/packages/vendor/10up/mu-migration/includes/commands/class-mu-migration-import.php on line 118

Does this make any sense? Could someone have a clue about what is going wrong?

anekola commented 3 years ago

An update: I'm paying closer attention to the numbers, and it seems to be continuing, but it's just taking a VERY long time. In one hour it has processed ~ 600 users. This particular site has 1937 users. Perhaps this is a resource issue? I'm running this on local server, which is https://varyingvagrantvagrants.org.

The PHP errors occurred on a site with over 8000 users, which I haven't tried again, but will this afternoon.

nicholasio commented 3 years ago

Looks like there's something wrong going on. Can you open the .csv file inside the zip file and check if the CSV is malformed?

It's easy to break CSV files if there are special characters in any of the user fields.

anekola commented 3 years ago

The CSV seems fine. But it has 348 columns. Would that number significantly slow it down in your experience?

On Mon, Jan 11, 2021 at 12:55 PM Nícholas André notifications@github.com wrote:

Looks like there's something wrong going on. Can you open the .csv file inside the zip file and check if the CSV is malformed?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/10up/MU-Migration/issues/88#issuecomment-758118874, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAON73OGBO4HMEPDYX5TSR3SZM3PRANCNFSM4VZTFCSQ .

nicholasio commented 3 years ago

I assume the users have a lot of custom meta, so yes it should slow down as for each user the import script will have to make individual calls to update each post meta (this can probably be improved).

The warnings you're getting are definitely concerning though as they seem to indicate bugs in the logic to import users.

anekola commented 3 years ago

Thanks @nicholasio – I was able to get into the CVS and remove columns I didn't need. That sped things up. The server still incrementally slowed down, so I occasionally needed to stop and restart the machine. Luckily, it picked up where it left off with users.

The warnings were related to a plugin issue. I'm on WordPress VIP, and it doesn't notify me when to update mu-plugins locally :) Sorry about that!