Home Forum Advertise Contact Me About WPTavern WPWeekly Show Info

Go Back   WordPress Tavern Forum » WordPress » Plugins And Hacks

Plugins And Hacks Anything and everything related to plugins

Reply
 
Share LinkBack Thread Tools Display Modes
  post #1 (permalink)  
Old 05-25-2009, 04:24 PM
Here For The Peanuts
 
About
Join Date: Jan 2009
Posts: 191
Icon3 Safe Database Search & Replace Tool

If you've ever tried to migrate an entire WordPress install across different domains or servers, whilst trying to keep things like widgets and plugins alive, you'll be aware of the difficulties. You can't do a search and replace on a database dump because it corrupts serialised PHP data in the database. The only quite unpalatable choice is to fix the serialisation strings by hand - slow, and error-prone.

We have one site that runs something like 150 widgets - a nightmare in a migration, and I really wanted to have a local, byte perfect copy of the site on my local machine for proper testing and experimentation.

I also knew it would be a pain and it finally motivated me to write a tool that allows you to do a search and replace across an entire database schema (or database depending on the way you like to talk about these things ).

It's not user friendly - in fact, it's built very much as a developer's tool right now, and I haven't yet been through and tidied up the code although I have tested it. I personally am very new to PHP although I'm an experienced developer, so I'm aware that because of this the style of the code is all over the place - so apologies for that.

Obviously it's supplied without guarantee - more info about this safe(r) database search and replace tool over at: http://www.davesgonemental.com/mysql...erialized-php/
Reply With Quote
  post #2 (permalink)  
Old 05-25-2009, 04:49 PM
andrea_r's Avatar
WPTavern Forum Moderator
 
About
Join Date: Jan 2009
Location: Eastern Canada
Posts: 809
Default

Will check it out. :) We have to do this quite a bit.
Reply With Quote
  post #3 (permalink)  
Old 05-25-2009, 04:55 PM
Here For The Peanuts
 
About
Join Date: Jan 2009
Posts: 191
Default

Do let me know how you get on with it and if you can suggest any improvements. For most migrations you only have to run it once with the domain name.

It was just driving me crazy that there was no easy way to develop a site offline and then migrate it very quickly onto a live server, minimising downtime.
Reply With Quote
  post #4 (permalink)  
Old 05-25-2009, 05:15 PM
Hello World
 
About
Join Date: Apr 2009
Posts: 10
Default

Very cool Dave, I have to do this quite a bit as well, and I usually just chalk up widgets to a loss, and redo them after the switch. I'll try to give this a try later today and let you know how it works for me.
Reply With Quote
  post #5 (permalink)  
Old 05-26-2009, 02:25 AM
Here For The Peanuts
 
About
Join Date: Jan 2009
Posts: 191
Default

Peter that's great - look forward to hearing your feedback. I usually do the same as you, but it frustrated me and I knew that they would come when we needed to do something with Telecoms.com (one of our biggest clients) that would need the widgets preserving. With 150 and rising, this wasn't something I relished. Given the site would need migrating to 2.8 I felt it was time to sort this out.

We might have some major issues with that site in 2.8, given the change to how multi-instance widgets has been implemented. Could be fun....
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:40 AM.