Thursday, April 4, 2013

Migrating moodle 1.8 courses to 2.4

We have a customer that has been hosting their own moodle server with instance 1.8.  They lost their moodle administrator and have been limping along on version 1.8.  They contacted us to look into moving their courses and users from their moodle to ours.  We already had a 2.4 instance set up for their organization, so it was just a matter of migrating the courses.

As I looked deeper into this problem, I realized it was not really possible to simply use the backup and restore process, including user data, to solve this problem.  I found a moodle forum that stated what I had experienced while trying to restore course backups from 1.8 with user data to 1.9 and then to 2.x.
"
  1. Upgrade to 1.9.19+ (the latest 1.9 version). This is pretty much required before jumping to a 2.x version. Failing to do this tends to cause problems converting your content.
  2. Upgrade to 2.2.7+ (the latest 2.2 version). This is as far forward as you can safely upgrade from 1.9.
  3. Upgrade to 2.4.1 (the latest 2.4 version). This is a little "bleeding edge" for me, still on 2.3.4 here, but is classified as "stable" at this point.
"
Full forum discussion... and
Another forum discussion

These are the steps I performed to migrate the courses from 1.8 to 2.4

1 - Create backups of the 1.8 courses with user data
2 - Save or copy the backup .zip files from the 1.8 server to a shared location
3 - Create a new DB for the moodle 1.9x install in next step
I am using phpMyAdmin to create the new DB.  Make sure you have the connection credentials for the new DB(a user account with proper permissions to create tables). When you create the new 1.9 instance, you will need to connect the new instance to the new DB.
4 - Create a new install of moodle 1.9.x
You may need to download the latest version of moodle 1.9.x.  Once downloaded, unzip and extract the files. Open the moodle folder and copy all the directories and files into the root of your new 1.9 instance.  Once copied,  browse to the root of the 1.9 instance(using your web browser)Keep careful track of  the admin password created, you will need to login to the 1.9 instance.
5 - Login to the new 1.9 instance.  Create a new empty course.  
Click on the new empty course, then proceed to restoring the 1.8 backups.
6 - Restore each of the 1.8 course backups in the 1.9 instance
   Verify that the course content and user data looks ok, otherwise, no point in continuing
7 - Upgrade the 1.9 instance to 2.2.x - in place upgrade
You may need to download the latest version of moodle 2.2.x
Remember to copy the config.php file first from the 1.9 root, then delete the moodle files from the 1.9 instance root then copy the 2.2.x files into the root where you just removed the 1.9 files.  Copy the config.php back into the root.  This step keeps the DB connections, data folder location and user passwords.
8 - Upgrade the 2.2.x instance to 2.4.x - in place upgrade.   
You may need to download the latest version of moodle 2.4.x
Remember to copy the config.php file first from the 2.2 root, then delete the moodle files from the 2.2 instance root then copy the 2.4.x files into the root where you just removed the 2.2 files.  Copy the config.php back into the root.  This step keeps the DB connections, data folder location and user passwords.
9 - Create new course backups from the 2.4.x instance, including user data.
10 - Restore the course backups on the existing 2.4 instance.

Notes:

You will need to save the 1.8 backup files to a shared location so you can access them for the restore on the 1.9 instance.  I have a Novell drive that I use to save the backups.  You could also use a thumb drive.  To find the backup for a course, select the course, choose restore,












then right click on the restore link to the right of the .zip file and choose Save Link As...  Brings up dialog box that allows you to save the backup to a new location.

I am using MySQL and phpMyAdmin to assist in this process.  I have a server that already has passed the moodle 2.x requirements.  If you are trying to migrate courses from 1.8 to 2.x, you will need a separate moodle server, as moodle 2.x requires versions of MySQL and PHP that are probably not on the server that is hosting the 1.8 moodle instance.

The real aha for me during this process was that I could move all the courses with their data from 1.8 to 1.9 and THEN UPGRADE THE 1.9 instance to 2.2 and then 2.4 - and create new 2.4 backups to restore to my existing 2.4 instance.  I actually told my customer that we would only be able to move the content and have to let students in the 1.8 instance finish up in their old courses, while enrolling new students in the new instance....because I could not upgrade their 1.8 instance.  It was when they panicked and I thought harder on the problem when I realized that I could restore the 1.8 backups to a 1.9 instance on MY SERVER, then I could upgrade the 1.9 instance, since it was on MY SERVER, not theirs.

Try first with a single course, then do a mass number.  In other words, when this plan was clear to me, I picked ONE course that had lots of students and content and migrated it through the entire process BEFORE I attempted on a larger scale.  This meant 1 course from 1.8 - to 1.9 - 2.2 - 2.4 and then restored on my live 2.4 server.  I checked carefully that my assertions were correct.  Once I saw this to be true, I deleted the course from the final 2.4 instance and started over.  I had to put up a new empty 1.9 instance, since I had upgraded it to 2.4 during the dry run....

Once the courses and their users were migrated, I reset all the passwords to changeme for the migrated users.  This forces them to change upon their initial login at the new site.  We put the old 1.8 instance into Maintenance mode with a message about contacting someone to get the new temporary password and included a link to the new site.

I also made some changes to the 2.4 instance to make it look as much as possible like the 1.8 site.  I applied a category wide theme, turned on and off a couple blocks, and ordered the courses in the category to match the old site.  Little things like this to make it not look too different.  

In the end, I learned a lot and more importantly, had a couple very satisfied customers.

1 comment: