Need help restoring a Moodle 1.9 backup please

Need help restoring a Moodle 1.9 backup please

by Gwen Barnes -
Number of replies: 10

I'm a moodle newbie, and I've been given a backup of a moodle 1.9 site by a client who wants the course data upgraded to the current 2.x version so it can be exported as MBZ files for use in another application.

The client has already indicated that they will not upgrade their live site from 1.9 to 2.x as the migration to a newer version does not migrate all the data they require for other uses of the site.

So far, I've installed xampp with moodle 2.6. on a Windows 7 computer. I've also successfully created new instances of moodle versions 1.9.19+ and 2.2 11 which is the planned intermediate step in the upgrade. I downloaded these packages yesterday from http://download.moodle.org/.

Each of these installations has created a new moodle site independent of the others in separate directories and databases, and I can get to each one and log in as administrator.

The backup I've been given consists of the following items:

  • SchoolName.zip
  • SchoolNameNew.zip
  • SchoolNameNew2.zip
  • vle_schoolname_edu.sql
  • course-data.tar

where "SchoolName" is the name of the school.

The three zip files seem to contain theme information (stylesheets, icons, etc.) but no actual site content.

The course-data.tar file appears to contain the course files I'm looking for (almost 40 gigabytes of it in dozens of folders and subfolders under a top level folder called course_data). Some appear to contain SCORM files (ZIPs with imsmanifest.xml at the root level plus lots of files), others are just folders with collections of files.

I've tried uploading the 300MB .sql file as it appears to contain the structure of the site -- courses, forums, etc.) but the uploader rejects it as it's over 2mb.

I've looked through the documentation and searched the forums for information on how to restore this data, but they all seem to discuss scenarios that don't match mine -- populating a clean install with data from an existing site via the backup files I was given.

I've also found documentation on restoring individual courses, but those scenarios assumed I would be doing that as a teacher, restoring into a course that already exists, not as an admin recreating an entire site.

Is there any way to accomplish what I need with the files I've been given? If not, could you let me know please what specific data I need from them?

Average of ratings: -
In reply to Gwen Barnes

Re: Need help restoring a Moodle 1.9 backup please

by Gwen Barnes -

OK, I've made a little bit of progress, I think. I have edited the php.ini file to increase the maximum file size, and am importing the SQL file into my moodle 1.9 site.

Once that's done, any suggestions on what I do with that huge course-data.tar file?

In reply to Gwen Barnes

Re: Need help restoring a Moodle 1.9 backup please

by Bret Miller -
Picture of Particularly helpful Moodlers

Honestly, I'd probably use the mysql command-line utility to import the SQL. You need both the sql data and the "moodledata" directory contents to successfully restore a moodle site. Then you'll need to run the search/replace tool to change the URL in the database so things display right. You'll find those instructions in "Moodle Migration" for the version of Moodle you're using.

Average of ratings: Useful (1)
In reply to Gwen Barnes

Re: Need help restoring a Moodle 1.9 backup please

by Guillermo Madero -

Hi Gwen,

I know you have already started, but I'd suggest the following route:

0. Ask your client the login info of the admin user.

1. If you don't have it yet, install phpMyAdmin (I just saw that the Xampp package includes it, but I'll leave this as a reference).

2. Create a directory named course_data outside of the DocumentRoot Directory (e.g. c:\xampp\course_data)

3. From the SQL backup you have, get the name of the database and use phpMyAdmin to create a new database named like the original. You can create the database user with all the permissions and the corresponding database in one step.

4. Install the latest Moodle 1.9.x version using course_data as the name for the Moodledata directory and the name you used for the database. Once finished, logout.

5. Now unpack the contents of the course-data.tar file. You first need to check if the file was created by packing the course-data folder or its contents. In the former case you would overwrite the course-data directory you created in step 2; in the latter, you would just unpack the contents in the directory.

6. Restore the vle_schoolname_edu.sql SQL file.

7. Log in and check that everything is working fine.

Assuming everthing went fine up to this point, then:

8. Log out and backup your complete installation  (the xampp, moodle code, moodle data and database folders). As everything must be under the xampp folder, just pack it.

9. Upgrade the installation to the latest 2.2.x Moodle version.

10. Log in and check that everything is working fine.

Assuming everthing went fine up to this point, then:

11. Log out and backup your complete installation.

12. Upgrade the installation to the latest 2.6.x Moodle version.

13. Log in and check that everything is working fine.

Once again, assuming everthing went fine up to this point, then:

14. Log out and backup your complete installation.

15. Log in and start creating the course backups.

Cheers!

 

--- References

Installation

Backup

Average of ratings: Useful (2)
In reply to Guillermo Madero

Re: Need help restoring a Moodle 1.9 backup please

by Gwen Barnes -

Wonderfully helpful, thanks very much.

I'm making slow progress -- seems they've done a lot of customizing, so getting it to log me in without referencing their own website is a bit of a challenge. I think editing the sql dump to keep it from creating and populating user accounts will help with that.

The course_data makes sense as you've explained it, so I'll drag that over next.

Are there any working conversion tools that will migrate these courses in a batch from v1.9 to 2.x MBZ format? All the ones I've found so far are hit and miss and some appear to have been abandoned some time ago.

There are a few dozen schools that need their data migrated, and the local authority in charge isn't in a position to upgrade their existing Moodle server hardware to support v2. Are there UK based Moodle consultants out there who have done this sort of thing?

In reply to Gwen Barnes

Re: Need help restoring a Moodle 1.9 backup please

by Guillermo Madero -

Hi Gwen,

The database should reference resources like files, images and such, but, unless they were using some external authentication system you shouldn't have any problems logging in.

As what you are doing is only to migrate their courses to a newer Moodle version, I skipped the process to change the Moodle URL (by using the replace.php script); however, if you need to update the address referenced in the database, then add this step.

Some time ago a few tools were developed, but as you already have found out, none are really that useful. The best course of action is by upgrading (definitely more work but one gets the best results).

If they won't have their severs upgraded to support Moodle 2, why do they need to migrate their data?

Average of ratings: Useful (1)
In reply to Guillermo Madero

Re: Need help restoring a Moodle 1.9 backup please

by Gwen Barnes -

Made some minor progress again yesterday and today.

I did a search/replace in a text editor to change all instances that pointed to their servers back to localhost, did a bit of other tidying, and imported the SQL file minus the users into my v2.2 instance. I'm now attempting to upgrade, but it keeps aborting because some table already exists that shouldn't, or vice versa and I have to fix that and start the upgrade right from the beginning again.

They need their data migrated because they want to import it into a different LMS that only supports MBZ and Common Cartridge files, and they don't want to recreate all their courses from scratch in their new LMS if they can import what they've already got. As you note, none of the conversion tools are much use.

Thanks again for your help. I'll have another go at this to see what I might still be doing wrong.

In reply to Gwen Barnes

Re: Need help restoring a Moodle 1.9 backup please

by Guillermo Madero -

Hi Gwen,

There could be a possible issue by searching and replacing directly at the SQL file, because many URL references are stored in serialized arrays.

Oh, I see, they are not going to use them directly in Moodle.

Yes, this kind of activities require some patience, so do not despair smile

In reply to Gwen Barnes

Re: Need help restoring a Moodle 1.9 backup please

by Gwen Barnes -

Progress update:

I managed to import what I think are the necessary tables so I can upgrade and export the courses. It's starting to look a little more useful, but I'm not quite there yet I think.  I can log in and (sort of) browse course categories, but all the categories are empty except for a couple. When I drill down into the categories that are populated with courses, all I get is "No courses in this category"

Here are the tables I imported from the very large SQL file provided to me. Any guesses about what I might be missing?

mdl_course
mdl_course_allowed_modules
mdl_course_categories
mdl_course_display
mdl_course_meta
mdl_course_modules
mdl_course_request
mdl_course_sections

mdl_user
mdl_user_info_category
mdl_user_info_data
mdl_user_info_field
mdl_user_lastaccess
mdl_user_preferences
mdl_user_private_keyStructure

In reply to Gwen Barnes

Re: Need help restoring a Moodle 1.9 backup please

by Guillermo Madero -

Hi Gwen,

I don't know how are you doing this, but it really seems to me that you are taking quite a long road thoughtful

In reply to Guillermo Madero

Re: Need help restoring a Moodle 1.9 backup please

by Gwen Barnes -

Long indeed.

After many attempts, I have given up trying to get the original site to upgrade. The upgrade starts, then goes for a beer somewhere around doing the "files".

I did finally learn through experimentation that v2.x will happily 'restore' Moodle 1.9 course backup ZIP files, which I can then back up again as MBZ files, which is all this really needed to do.

Uploading personal files seems to support dragging and dropping multiple files into the upload box; uploading to where the course restore page actually wants to see them (private backup files) only supports one at a time. I have hundreds of schools, each with hundreds of courses.

When restoring the courses, I see that I can select multiple files in the list, but the only options I have for my selected files is to move them to another folder. I was really hoping one of those options would be "restore selected courses".

I can see that doing the uploads one click at a time will be quite time consuming; the restoring even more so because I have to click through several screens to make it happen.

Has any thought been given to make this just a little easier for one lonely non-technical admin to accomplish? Or is this such an unusual use case that it's not worth anyone's time to develop a solution?