[wp-hackers] Best functions in WP for bulk MySQL processing?

Mike Schinkel mikeschinkel at newclarity.net
Sun Mar 14 11:23:16 UTC 2010


On Mar 14, 2010, at 3:16 AM, Harish Narayanan wrote:
> It might be more robust (and I imagine quicker) to dump the database to
> file, perform whatever transformations you need using standard command
> line utilities like sed, and then reinsert the modified data to your new
> database server.

Thanks for the idea. 

That's what I've done in the past but it fails for any serialized data.  WP 3.0 adds more hardcoded URLs into the database (menu links and header and background URLs for the Twenty Ten theme) and changing some of those with text search & replace breaks them.

See what I've done in my other email.  What I'd really like to see is a system that when deployed will notice that the URL is different and make all adjustments, calling hooks from core and other plugins to allow them to make the changes they need to make.  I'm going ahead and writing this as a plugin to prove the concept but it really will only be fully useful if it gets into core where all the edge cases can get ironed out (I'll never catch them all myself) and where it can become a best practice for plugin authors to write hooks to switch persisted URLs when the domain changes. 

-Mike


More information about the wp-hackers mailing list