-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add a CLI migration command to update attachment file names #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linting failed (153 errors).
(142 notices occurred in your codebase, but were on files/lines not included in this PR.)
We could perhaps update the script to dump out the file name replacements as a series of CLI commands to run if anyone needs to update data other than the |
$count = WP_CLI::runcommand( | ||
sprintf( | ||
'search-replace %s %s --format=count --url=%s', | ||
$size_data['file'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be reeeeaaalllyyy slow!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! I'm not sure it's really avoidable though. Would be great if search-replace
supported arrays of things like str_replace()
... Given it's a one time migration script it might not be so bad but this seems like the most robust way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm ok, lets go with it for now then!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ryan had some better suggestions to make it faster using transactions so going to try that out today
Added this migration command to a separate repo here instead so it's not dependent on Tachyon being active at the time. |
This does DB replacements on the post_content column only, and clears caches. It's going to be a pretty heavy process to run.
Solution to #43