MIgrating moodle using course backup/restore, then changing domain name

MIgrating moodle using course backup/restore, then changing domain name

by Mike Green -
Number of replies: 1

Hi all - hope this is the appropriate forum for my query , I think my issues hinge around the backup/restore process.

We are upgrading from moodle 1.9 to 2.4.

We have built a fresh install of moodle 2.4, and are going to backup up our courses in our moodle 1.9, and restore them to our moodle 2.4.

My plan is to transfer the domain name of the 1.9 moodle (moodle.solihullsfc.ac.uk) to the new moodle, after the courses have been restored to moodle 2.4. Currently our moodle 2.4 just has a numerical i.p. address.

I'm aware that there can be problems with absolute links to files when restoring courses from one moodle to another, which can be addressed by using the replace.php script to update the domain name.

If I've understood it correctly, when we restore our courses to moodle 2.4, the links will be stored in the databases as absolute links (that is, with the numerical i.p. address),  so when we transfer the domain name, we will have to run the replace.php script to correct the links to using the moodle.solihullsfc.ac.uk domain name. Can anyone confirm that this is right?

And if anyone thinks this process of upgrading is clearly unsound, please suggest a better approach! (We've tried to upgrade the whole site in one go, but couldn't get past database errors.)

Many thanks for any support/advice you can offer!

Average of ratings: -
In reply to Mike Green

Re: MIgrating moodle using course backup/restore, then changing domain name

by Lawrence N -

This what I have done to make a copy of our production database over to our development environment (assuming you are using a *Nix platform)

Do a database backup using mysqdldump and let's say we call the file production.sql

Make a copy of production.sql and call it newurl.sql (this way you can always go back to the original if things fail)

Now run this Nix command

sed -i ‘s/original_url/new_url/g’ newurl.sql

the “g” at the end tells sed to perform the action globally to replace whatever was in "original_irl" to the new one you want (new_url).

In your case:

sed -i ‘s/http://moodle.solihullsfc.ac.uk/http://x.x.x.x/g’ newurl.sql

Now restore the database using the newurl.sql file into the database.

Don't forget to change your config.php in your moodle 2.4 root to use the new url.

This should work.

Good luck