1 of 2
1
EE Migrate
Posted: 02 December 2006 06:58 PM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1194
Joined  01-05-2006

Here is a very risky “extension”.  If you’re forced to move your EE install to a different path it can be a pain to find all the locations of your server path or url, so I’ve made a global “find and replace” utility.  It run’s outside of the CMS, in case you’re using it to update the config.php file.  In short here is what it does:

1. Finds all occurrences of str1 in the config.php file and replaces it with str2
2. Finds all occurrences of str1 ANYWHERE in the database and replaces it with str2

Because the changes this file makes are so great, please do not run it without backing up both your database and your config.php file.  Even after doing so, please make sure you understand what you’re doing because this can cause a lot of headaches if used incorrectly.

That said, I’ve used this file many, many times to port several builds across servers and it works well.  Please let me know what you find.

To Install:
Place the eemigrate.php file inside your “system” folder.  Navigate to it from a web browser, and enter the find str and the replace str.  Click “Go”.  Choosing alter database will toggle the ability to search through the database.

Thanks to Paul for the great idea: http://expressionengine.com/forums/viewthread/40339/

UPDATE:
Taken down because of lack of updates.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 02 December 2006 07:02 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

Mark,

I don’t want to actually try because I’m a wimp - does this have an intermediary step where it echos everything it finds so that you can see what it’s about to do?

 Signature 
Profile
MSG
 
 
Posted: 02 December 2006 07:03 PM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1194
Joined  01-05-2006

It doesn’t but give me some time and I can build that in.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 02 December 2006 07:05 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

Thank you.  Sounds like a good safety measure. =)

 Signature 
Profile
MSG
 
 
Posted: 02 December 2006 07:35 PM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1194
Joined  01-05-2006

Alright, version 1.0.1 has a little warning screen that tells you the db columns and config params that it’s about to change.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 02 December 2006 09:16 PM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1841
Joined  03-26-2006

This is fantastic. I might have more comments on it later, but at first try it seems to work well and will save me a lot of time moving things from local to dev, and then to live servers. Mark, I owe you some money for all your hard work - heading to your site now to pony up. Thanks.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 23 February 2007 11:54 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  11-12-2002

Mark: This looks great- I’m trying it now and getting the following error:


There was a problem searching ee.exp_member_search.fields:

SELECT fields FROM exp_member_search WHERE fields LIKE ‘&#xmy;.olddomain.com%’


I checked a few installs and find no data in that field whatsoever.

Profile
 
 
Posted: 24 February 2007 07:18 AM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1194
Joined  01-05-2006

dfbills, try version 1.0.2 up top.  It adds backticks around the field name so you won’t get a MySQL error (I hope!).

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 25 February 2007 10:14 AM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  11-12-2002

I’m using 1.0.2 and getting this result:

EE » Migrate (1.0.2)
There was a problem searching EE_lists.exp_member_search.fields:

SELECT `fields` FROM exp_member_search WHERE fields LIKE ‘&#xsu;bdomain.mydomain.com%’

Profile
 
 
Posted: 25 February 2007 04:34 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  183
Joined  03-21-2006

@mdesign

Mark has a donation place on his website.  I don’t want to speak for him, but I’m sure you can give him as much as you’d want smile

http://docs.markhuot.com/

[edit]

So I have A.D.D. and didn’t read the rest of your post first because I saw something shiny!

 Signature 

http://www.sethaldridge.com/

Profile
 
 
Posted: 26 February 2007 09:13 AM   [ Ignore ]   [ # 10 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1194
Joined  01-05-2006

@dfbills: You probably need backticks around the other field name:

SELECT `fields` FROM exp_member_search WHERE `fields` LIKE ‘&#xsu;bdomain.mydomain.com%’

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 26 February 2007 11:11 AM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  11-12-2002

I’m getting the same error with even a simple text string like “text”.

Profile
 
 
Posted: 26 February 2007 11:15 AM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1194
Joined  01-05-2006

right, `text` and `field` are both SQL keywords, so that’s why they would need the backticks alerting SQL that you’re not referring to the keywords, but the field names.  anywhoo, i’ve updated the ext to 1.0.3 see if that fixes your problems.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 27 February 2007 10:07 PM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  11-12-2002

It does run successfully now- although it seems to miss a few fields that need proper updating.

Profile
 
 
Posted: 07 March 2007 01:30 PM   [ Ignore ]   [ # 14 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  11-12-2002

Fields I noticed immediately:

Table                              Field
---------------------------------------------
ee_weblogs                     blog_url
exp_global_variables        variable_data

Profile
 
 
Posted: 07 March 2007 01:38 PM   [ Ignore ]   [ # 15 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1194
Joined  01-05-2006

Hum, that’s strange because it’s doing the replace on ALL tables and fields.  I don’t have a list coded in there at all, it just grabs a list of all the tables and their fields then runs a replace on that.  Are you sure you’ve entered a string that exists in those fields?  Are you sure there’s content to replace?

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 07 March 2007 02:21 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  11-12-2002

Yes, I definitely had the data in there, I had to change it by hand to get up and running.  I’ll be trying it again in the next couple of weeks and will report back.  This tool sounds like just the ticket for me.

Profile
 
 
Posted: 15 March 2007 02:56 PM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  11-12-2002

Mark:  I used 1.0.3 successfully yesterday to launch a site.  Here’s what I’ve written in my documentation:

—-

  The migrate tool will change embedded domain name and server path variables.  The following data is needed:  original host name, target host name, original server path, target server path. 
 
  The tool is available here:
 
  http://FINAL.DOMAIN.NAME/system/eemigrate.php
 
  The tool should be run twice:
 
  1.  Replace the host name
  2.  Replace the server paths

  Note: The folder “system” is a placeholder variable for EE system folder.  This folder should be renamed and not called “system”.

—-

It might be nice to actually tailor the tool to this purpose, prompting the user to complete the two-part process.

Profile
 
 
Posted: 29 April 2007 11:46 PM   [ Ignore ]   [ # 18 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  525
Joined  04-23-2006

I’ve used this offline a few times already.
I moved an installed of EE to a different directory on Ubuntu, and ran this script.

Works flawlessly!
Three times thus far!

I’m sure (hoping so, really!) ... but pretty darned excited about getting my site ONline, so I can really test this out.

Thanks Mark!

 Signature 

OLD username was jammo, NEW username is OrganizedFellow

It’s a struggle even to keep focused. This is the best of my AD/HD & GTD.
The exceptionally slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66468 Total Logged-in Users: 32
Total Topics: 84863 Total Anonymous Users: 23
Total Replies: 455356 Total Guests: 165
Total Posts: 540219    
Members ( View Memberlist )