We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

EE Migrate

Development and Programming

Mark Huot's avatar
Mark Huot
587 posts
16 years ago
Mark Huot's avatar Mark Huot

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://ellislab.com/forums/viewthread/40339/

UPDATE: Taken down because of lack of updates.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

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?

       
Mark Huot's avatar
Mark Huot
587 posts
16 years ago
Mark Huot's avatar Mark Huot

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

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

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

       
Mark Huot's avatar
Mark Huot
587 posts
16 years ago
Mark Huot's avatar Mark Huot

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.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

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.

       
dfbills's avatar
dfbills
56 posts
16 years ago
dfbills's avatar dfbills

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.

       
Mark Huot's avatar
Mark Huot
587 posts
16 years ago
Mark Huot's avatar Mark Huot

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

       
dfbills's avatar
dfbills
56 posts
16 years ago
dfbills's avatar dfbills

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%’

       
seth.aldridge's avatar
seth.aldridge
68 posts
16 years ago
seth.aldridge's avatar seth.aldridge

@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 😊

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!

       
Mark Huot's avatar
Mark Huot
587 posts
16 years ago
Mark Huot's avatar Mark Huot

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

SELECT `fields` FROM exp_member_search WHERE `fields` LIKE ‘&#xsu;bdomain.mydomain.com%’
       
dfbills's avatar
dfbills
56 posts
16 years ago
dfbills's avatar dfbills

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

       
Mark Huot's avatar
Mark Huot
587 posts
16 years ago
Mark Huot's avatar Mark Huot

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.

       
dfbills's avatar
dfbills
56 posts
16 years ago
dfbills's avatar dfbills

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

       
dfbills's avatar
dfbills
56 posts
16 years ago
dfbills's avatar dfbills

Fields I noticed immediately:

Table                              Field
---------------------------------------------
ee_weblogs                     blog_url
exp_global_variables        variable_data
       
1 2 3

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.