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

Use batch processing to migrate attachments #71

Open
fklein-lu opened this issue Nov 18, 2015 · 5 comments
Open

Use batch processing to migrate attachments #71

fklein-lu opened this issue Nov 18, 2015 · 5 comments

Comments

@fklein-lu
Copy link
Contributor

The WP CLI migrate-attachments command uses a WP_Query with posts_per_page set to -1.

With a larger data set, this will lead to issues. We should investigate on how we could use batch processing for the migration.

@danielbachhuber
Copy link

You can use WP_CLI\Iterators\Query: https://github.com/wp-cli/wp-cli/blob/master/php/WP_CLI/Iterators/Query.php

@fklein-lu
Copy link
Contributor Author

Awesome! 👍

@joehoyle
Copy link
Member

@fklein-lu I've actually been considering removing migrate-attachments, really it's a lot more robust to use upload-directory and then run a find-replace via wp-cli. Perhaps we could repurpose migrate-attachments to be migrate-uploads which would just copy all the uploads to the S3 bucket location, then run a search-replace. Doing the attachments one-by-one in this command is problematic as it can miss files that might be stored in uploads but not directly referenced by attachment metadata.

@dev169
Copy link

dev169 commented Nov 28, 2015

@joehoyle That would make sense. As things are currently, is there any reason to prefer migrate-attachments over upload-directory?

@joehoyle
Copy link
Member

@dev169 not really, I added the migrate-attachments command before the upload-directory one which is why it exists.

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

No branches or pull requests

4 participants