I know this has been discussed plenty of times, however I'm going to ask any way and hope I get a clear answer. I'm looking to run a script that will back up the production server and copy procution files and data over to a test instance. Thanks to some posts, I was able to write a script that copies the necessary files from the sites/www.whatever.com/ and dumps the database.
What I'm looking to do is creating a script that will copy those files in the the sites/test.whatever.com and run the SQL file generated from the back up into the test database.
However looking at this, it seems a little difficult.
Here is what I know so far:
1.) I'll have to update the base_url assignement in settings.php
2.) The database settings in settings.php will need to be updated to reflect the instance database values.
3.) The SQL file will need to be executed on the test database with proper parameters (updating table prefixes, etc).
I'm thinking there will be a lot of text replacement using sed.
What I'm not sure about is how to easily script change values in the that contain either a full URL or a path setting such as the file location.
So I think I would have to change any string in the SQL file that has 'http://www.mysite.com/whatever' to 'http://test.mysite.com/whatever'.
And for path settings if there is a variable in the database stored as 'sites/www.mysite.com/files' that would need to be changed to 'sites/test.mysite.com/files'.
Has any body achieved automating a similar process.
Thanks,