[wp-hackers] [GSoC 2011] Moving Wordpress

ErisDS (Hannah Wolfe) erisds at gmail.com
Sun Mar 20 20:16:27 UTC 2011


Hi Brian,

A quick reply to your comments:


> 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).


I don't really think the script needs optimising - this is a run-once kind
of thing and therefore the speed isn't important, at least to me. I change
the GUID for completeness & to make sure there are no issues with plugins
which misuse the GUID as a URL.

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.


Nowhere in the script does it do a find and replace across the whole options
table. It only updates home and siteurl, therefore doesn't come across the
serialisation issue.

I've not seen plugins which put absolute URLs in the options table, but no
doubt there are some out there. So this would probably be a good addition.
Anyone got any examples of plugins which do this?

At the moment Migrate! is just an old script that I have been using for ages
to do the simple task of updating database values after migrating a site.
All I did prior to putting it on my blog was tidy the code a little and
update the UI so hopefully its self explanatory.

I do hope to turn it into a full plugin with many more features, I know
there are plenty of things out there that do what Migrate! does & lots of
projects like this though :)

Hannah

On Sun, Mar 20, 2011 at 6:45 PM, Brian Layman <wp-hackers at thecodecave.com>wrote:

> 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
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list