[wp-hackers] [GSoC 2011] Moving Wordpress
Brian Layman
wp-hackers at thecodecave.com
Sun Mar 20 18:45:23 UTC 2011
On 3/20/2011 2:09 PM, ErisDS (Hannah Wolfe) wrote:
> I have a script which does all of the database stuff.
>
> http://erisds.co.uk/projects/migrate
Nice script.
I hope you don't mind if I share some thoughts on it:
You are taking some steps to replace the GUID for the posts. However,
the GUID value, even if it has the old URL in there, really does not
need to be changed. In fact it is probably better to just leave it as
is. Your script would run faster if you didn't bother to change it.
(That said, I've done the same thing in earlier migration scripts of my
own).
The major issue I see is that you do not unserialize option_value while
you are updating the options table. The problem with this is that
because serialized strings encode the length of each string value, a
simple replacement will corrupt the entire serialized value. So if your
script is run on a blog that has "Welcome to blahblahblah.com" in a text
widget and you str_replace it with "Welcome to blah.com", the new site
will have lost all widgets on every sidebar. This could also be the
case for someone linking to a privacy policy in theme options. If they
type in a full URL instead of a relative url, then you lose all of the
theme options.
Serialized values are a MAJOR annoyance to anyone who regularly
manipulates the database directly. This is a very common issue in
migration tools/tutorials. Talking about it here spreads the word...
That said, Nice stuff. Thanks for sharing!
Brian Layman
http://eHermitsInc.com
Managed WordPress Hosting
More information about the wp-hackers
mailing list