+ Reply to Thread
Results 1 to 5 of 5

Thread: Safe Database Search & Replace Tool

  1. #1
    davecoveney is offline Tavern Regular
    Join Date
    Jan 2009
    Posts
    210

    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/

  2. #2
    andrea_r's Avatar
    andrea_r is offline WPTavern Forum Moderator
    Join Date
    Jan 2009
    Location
    Eastern Canada
    Posts
    1,279

    Default

    Will check it out. :) We have to do this quite a bit.

  3. #3
    davecoveney is offline Tavern Regular
    Join Date
    Jan 2009
    Posts
    210

    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.

  4. #4
    PeterButler is offline Hello World
    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.

  5. #5
    davecoveney is offline Tavern Regular
    Join Date
    Jan 2009
    Posts
    210

    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 to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts