Moodle
  1. Moodle
  2. MDL-84

Course archiving, backup, restore and reset

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_11_STABLE
    • Rank:
      7272

      Description

      Teachers and admin should be able to

      • back up an entire course as a single file (and download it).
      • restore a course from any given backup
      • empty a course of all student input and reset it for the next time around.

        Activity

        Hide
        Martin Dougiamas added a comment -

        From Greg Barnett (gregb at crowncollege.edu) Wednesday, 18 December 2002, 05:32 AM:

        In addition to being able to reset/copy/archive courses, it would be great if we could have a master version of a course, and as many simultaneous instances of the course as possible.

        As an example: we run a 3 week rotation for most of our classes. One class that is taught every other 3 week session is HUM125 (English Composition I). Our students taking HUM125 are split up into 3 groups. We have one group that meets in the morning (all students attend online). We have 2 classes that meet at night (one group online, the other face-to-face on our campus). We would like to have separate instances of HUM125 for each of these 3 groups.

        The ideal situation would be to have one main version of the course. Any changes to it would automatically apply to all current and future instances of the course (but future only would be acceptable). Any changes made to a course built from the master would trigger a popup box asking if the change should be applied to the master as well (if the teacher is listed as a teacher for the main course).

        We would also like to be able to choose which sections of a course are shared between all instances of a course. As an example: to reduce the possibility of cheating, we might want to modify quizzes for each instance, but to facilitate dialog, we might want some or all forums to be shared between instances.

        From James Miller (yositune at yahoo.com) Friday, 27 December 2002, 02:16 PM:

        The master/slave nuance would be very helpful.

        For example, I teach an info law course that sometimes is pure-play online only, and a more traditional lecture + moodle component.

        From Martin Dougiamas (martin at moodle.com) Thursday, 13 February 2003, 10:49 PM:

        I think this object-oriented inheritance approach might be better solved by the groups implementation.

        I'd like this bug should stay focussed on proper backups.

        From Martin Dougiamas (martin at moodle.com) Saturday, 1 March 2003, 04:18 PM:

        XML looks like the way.

        All the cross-referenced indexes need to be converted

        into some neutral and internally consistent numbering

        system that can be translated to fit into any Moodle

        server. On restore there should be matching done

        between usernames etc to renumber them correctly.

        The XML file should be saved in the course files

        area, so that the whole course directory can be

        zipped up and moved around.

        From Petri Asikainen (paca at sci.fi) Sunday, 2 March 2003, 12:40 AM:

        Should all modules have it's own backup/restore functions? At least restoring will need own logic for every module.

        From Martin Dougiamas (martin at moodle.com) Saturday, 22 March 2003, 10:59 AM:

        This is very high priority now.

        From Mark Berthelemy (mberthelemy at mrbeducation.co.uk) Monday, 14 April 2003, 03:42 AM:

        The XML structure you're suggesting to create copies of a whole Moodle course could also be used to create a SCORM compliant package - it would simply be a subset of the Moodle XML structure; containing just references to the course resources, rather than all the assignments etc.

        This would allow Moodle users to transfer course content created in other VLEs, or in course authoring tools that can output SCORM compliant packages (eg. Dreamweaver with the Manifest Maker extension).

        If you want to include Assignments and Choices in a SCORM package then Moodle will need to contain a SCORM compliant API adaptor and the Assignments etc will need to contain the correct javascript calls to the API. Probably not such a high priority at the moment...

        From Martin Dougiamas (martin at moodle.com) Monday, 14 April 2003, 09:59 AM:

        Something to keep in mind for the future, definitely. I've yet to find a real course encoded in SCORM format (there's only the very thin examples on the SCORM site)

        From Martin Dougiamas (martin at moodle.com) Wednesday, 16 April 2003, 06:57 PM:

        Eloy Lafuente (stronk7) is going to have a try at this. Go Eloy!

        From Martin Dougiamas (martin at moodle.com) Wednesday, 23 April 2003, 09:19 PM:

        Some ideas I wrote in an email a while back, which should be here for reference:

        My rough idea is a single script course/backup.php

        that allows you to select items like:

        x assignments

        x choices

        x forums

        x journals

        x peer graded assignments

        x quizzes

        x resources

        x surveys

        x include enrolments

        x include student-submitted information

        x include full user accounts

        x download the backup

        x compress the backup as a zip file

        x include uploaded files in final zip file

        which then creates a big xml file in the course files area

        with a standard naming scheme like backup-courseshortname-ddmmyyy-hhmm.xml

        The script can optionally create a new zip file of this backup xml

        file, and optionally add all the course uploaded files to the

        same zip, and then offer this zip as a download.

        Then later there would be a course/restore.php which does the same

        thing in reverse, roughly, allowing you to select parts that you want to restore into the current course.

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 23 May 2003, 08:11 PM:

        INFORMATION FOR SUBSCRIBERS !!!!

        Well. I've advanced a bit since the last post to this bug.

        The backup interface is finished and everything is backupable (except some mods).

        Now I've started the restore option.

        When I've finished its first executable (although limited) version, I'll inform you again.

        Every comment will be welcome (tests included, of course).

        Ciao.

        From Eloy Lafuente (stronk7 at moodle.org) Monday, 2 June 2003, 05:19 AM:

        INFORMATION FOR SUBSCRIBERS !!!!

        Now the restore seems to work with this limitations:

        • Logs are no restored.
        • Only assignments, choices, resources and surveys are

        restored.

        The next step is to complete (backup and restore) missing mods

        (forums, quizzes and workshops).

        And I need some help now:

        1st.) TEST, TEST, TEST and TEST !!

        2nd.) It will be VERY interesting for me to have some backups

        (from you) to make my own tests.

        When I've finished new modules, I'll update this bug.

        Ciao.

        From Martin Dougiamas (martin at moodle.com) Monday, 2 June 2003, 12:01 PM:

        Congratulations!!!

        I did a very quick run through of the process - overall it looks impressive so far - very clean interface. I did run into some problems but I'll do a better test tonight and send you some backups!

        From Greg Barnett (gregb at crowncollege.edu) Thursday, 12 June 2003, 09:51 AM:

        I didn't get all the way through contrib/stronk7/backup/, due to a problem with my installation of PHP, but what I saw looks promising. I'll try again once I've recompiled PHP with utf8 support.

        I'm going to recommend that someplace in the code you add a few configuration checks to make sure that the users PHP/Moodle installation is capable of making backups.

        something like the following:

        if(!function_exists('utf8_encode')

        { error('You need to add utf8 support to your PHP installation'); }

        here is the output I'm getting now:

        Creating temporary structures

        Deteting old data

        Creating xml file

        Writing header

        Writing general info

        Fatal error: Call to undefined function: utf8_encode() in /var/www/html/moodle/contrib/stronk7/backup/backuplib.php on line 295

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 13 June 2003, 01:48 AM:

        Hi greb, I've included a backup_required_functions in lib.php. It's called always in backup/restore. It stops the process if something fails.

        Thanks.

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 13 June 2003, 01:54 AM:

        Hi, everybody.

        I've finished the first executable version of backup/restore (backup everything, restore assignments, surveys, choices and resources).

        It seems to work with small/medium courses without change and with big courses doing some mysql conf. tunning (I'll try to avoid this, later).

        Now I'm going to develop the restore forums, quizzes and journals.

        Every test, comment or idea will be welcome !!

        TIA.

        From Gilberto Rodr?guez (giro at prodigy.net.mx) Thursday, 19 June 2003, 04:04 AM:

        Hi Eloy

        I'm trying this.

        It looks very nice. Tank's for your work.

        I recevie this error:

        Warning: mkdir() failed (No such file or directory) in /home/enlace/enlaceacademico-www/aula/contrib/stronk7/backup/lib.php on line 71

        It seems to be a folder permission.

        What folder I need to give write permissions?

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 20 June 2003, 04:35 AM:

        I need more information:

        • Win32 or Unix ?
        • The error occurs in backup or in restore ?
        • Can you tell me what do you have under your $dataroot directory ? Is there a temp dir ? And inside, there is a backup dir ?
        • What permissions do you have in the above directories ?

        TIA

        From Jacob Romeyn (jacob at romeyn.org) Friday, 20 June 2003, 07:00 AM:

        I have the same problem:

        Copying course files

        Zipping backup

        Copying zip file

        Warning: mkdir() failed (No such file or directory) in /home/www/moodle/contrib/stronk7/backup/lib.php on line 71

        My operation system is linux RedHat 8.0 and I have :

        $dataroot directory ? Is there a temp dir ? And inside, there is a backup dir ? all these have permission 777.

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 20 June 2003, 07:23 AM:

        Ok. The problem seems to be in backup, when copying the final file (zip) to the course area.

        One more (important) question. Your moodle language is set to ?

        TIA

        From Jacob Romeyn (jacob at romeyn.org) Friday, 20 June 2003, 11:26 PM:

        The language is set to enghlish

        From Gilberto Rodr?guez (giro at prodigy.net.mx) Friday, 20 June 2003, 11:40 PM:

        Hi, looks the same.

        Web Server: Apache Version 1.3.27

        Operating System: Linux Redhat Version 7.3

        roblem when backup-ing.

        I have my $datarrot outside web access with chmod 777 and works well for courses and users

        There is not temp or backup inside.

        Languaje: es

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 20 June 2003, 11:49 PM:

        Ok. It seems to be two possible errors.

        The first, language-related, occurs when the corresponding backupdir string in the current language is incorrect to be a dirname !!

        The second, when you are trying to backup a course without its own dir in $dataroot (one dir is created once a course need to save any file, but it it isn't needed, the dir isn't created). All the backup process will work, but, when trying to save the backup-file to its final location (the course dir), is possible that it doesn't exist. I've to check it !!

        Can you confirm any of this possible errors in your installation.

        TIA

        PD: If you see that there is no course_dir under your $datarrot, you can try to upload a file with Moodle's FileManager. It'll force the creation of the dir.

        Please, confirm !!

        From Gilberto Rodr?guez (giro at prodigy.net.mx) Saturday, 21 June 2003, 12:32 AM:

        Success!!!

        The error message still appears, but the backup was created. I'll check for strings.

        Send you a backup image .jpg just check it's all right, look at the top of page in Attachments section.

        From Eloy Lafuente (stronk7 at moodle.org) Saturday, 21 June 2003, 12:52 AM:

        Good !!

        The files in the .jpg seems to be correct.

        But the error persists. Can you make this:

        1-Can you send me a jpg (or html) with the backup progress ?

        1-Go to course table and look for the id (ID) of your course.

        2-Look under $dataroot and look for a dir with that ID name.

        Does it exist ?

        If not, create it by going to the Files option into the course.

        Does it exist now ?

        Backup the course and send me the result page, please !!

        TIA.

        From Gilberto Rodr?guez (giro at prodigy.net.mx) Saturday, 21 June 2003, 01:40 AM:

        I hope this is the image you want.

        All the folder exists and work, I upload files using file manager and works OK.

        The backup itself looks to work fine, the directory is created, and data created into it.

        From Gilberto Rodr?guez (giro at prodigy.net.mx) Saturday, 21 June 2003, 01:43 AM:

        I've also tryed in english an receive the same result.

        From Eloy Lafuente (stronk7 at moodle.org) Saturday, 21 June 2003, 03:57 AM:

        NEWS:

        =====

        Important changes in backup/restore internals.

        Changed 100% db temp storage to fs temp storage.

        Avoid a lot of limits and timeouts.

        More checks are included.

        Now I'm going to develop the restore of the rest of modules:

        • Journals (simple)
        • Forums (hard work)
        • Quizzes (HEAVY)

        I've included some minor debug output to check the mkdir() problem. Please, update the backup/restore utility (it must be 0.6.1 alpha) and execute the backup process again (giro and jacob). Send me the output, please.

        Anyway, try it and post any comment or problem.

        TIA.

        From Jacob Romeyn (jacob at romeyn.org) Saturday, 21 June 2003, 01:39 PM:

        I have send the backup zip to you by Email. But I still get the same error:

        Warning: mkdir() failed (No such file or directory) in /home/www/moodle/contrib/stronk7/backup/lib.php on line 71.

        And there is no way I know of to restore the file. When I start the restore.php file it can not find the zip file.

        From Eloy Lafuente (stronk7 at moodle.org) Saturday, 21 June 2003, 06:12 PM:

        Hi Jacob.

        I've received your backup and it seems to be restored without problems. I've included two photos (above) about your course in my test server (win2000a, win2000b).

        But you haven't updated the backup/restore. It has been created with 0.5.7 and it must be created with 0.6.1. The zip file generated is the same, but the new version makes more consistent checks. If, with this version, you have mkdir() problems, please save the html page (backup progress) and send me it. It includes some debug info.

        Final trick. If you upload the generated zip file anywhere inside the FileManager, a new Restore option must appear. Press it and enjoy restoring !!!

        From Jacob Romeyn (jacob at romeyn.org) Saturday, 21 June 2003, 11:50 PM:

        Very good everything works great. Thank you so much for this great contribution!

        From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 24 June 2003, 06:56 AM:

        NEWS:

        =====

        Now journals and forums are restored too !!

        I'll start with quizzes tomorrow (hard work !!)

        Please, test and inform me.

        TIA.

        From Eloy Lafuente (stronk7 at moodle.org) Sunday, 29 June 2003, 07:32 AM:

        NEWS

        ====

        I've splitted the quiz restore into two steps:

        1.-Restore categories and questios completely.

        2.-Restore quizzes itself (as a standard mod).

        STEP 1 is finished. I'll start STEP 2 tomorrow.

        Three comments:

        1.-In STEP 1, I check if category exists (only by name). If it exists, I append the questions to it, else I create a new category. I'm not sure if this approach is correct (duplication of questions ?). Comments will be welcome.

        2.-Any backup will be welcome to make different tests at home !!

        3.-Try it, try it, try it...

        TIA. Ciao.

        From Eloy Lafuente (stronk7 at moodle.org) Monday, 30 June 2003, 07:07 AM:

        IMPORTANT NEWS

        ==============

        Changes done in backup utility too !!

        Broken compatibility with previous versions !!

        Please, update from cvs and try backup & restore again. New version must be 0.7 alpha !!

        Included STEP 2 when restoring quizzes, but NO completed !!

        Please, can everybody send me example backups again (done with this new release, of course).

        Sorry and TIA.

        From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 1 July 2003, 01:17 AM:

        I'm having some problems restoring quiz_responses, due, in part, to some error-bug-or simmilar with RANDOM questions.

        I'll continue as I can.

        See MDL-543 for more info.

        Ciao.

        From Eloy Lafuente (stronk7 at moodle.org) Thursday, 3 July 2003, 06:46 AM:

        NEWS:

        =====

        New release 0.7.1

        It fixes (I think) one important bug in backup when forums and assignments do not contain associated files.

        Thanks to Daniel Miksik and his great inform about the issue.

        Ciao.

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 4 July 2003, 07:26 AM:

        NEWS

        ====

        New release 0.8.0.

        Quizzes are included completely.

        Broken backup compatibility with previous versions (due to some extra info needed to restore match questions.

        Please, try it. If possible send me some backups to do intensive tests.

        TIA, Eloy.

        From Martin Dougiamas (martin at moodle.com) Friday, 4 July 2003, 09:46 PM:

        Excellent work, Eloy ... I'm just about to have a closer look into it all. First I'm going to move all the code out into the main directory as /backup so that's where you should keep working on it from now on!

        From Martin Dougiamas (martin at moodle.com) Friday, 4 July 2003, 10:46 PM:

        CVS move is in progess (I have to ask Sourceforge to do it): http://sourceforge.net/tracker/index.php?func=detail&aid=765966&group_id=1&atid=200001

        From Eloy Lafuente (stronk7 at moodle.org) Saturday, 5 July 2003, 01:15 AM:

        Ok. I'll wait to move finished.

        I'm monitoring the tracker now.

        Ciao.

        From Gustav Delius (gwd2 at york.ac.uk) Wednesday, 9 July 2003, 07:58 PM:

        The backup module does not work from its new location in moodle/backup because the relative file locations have not yet been changed.

        From Martin Dougiamas (martin at moodle.com) Wednesday, 9 July 2003, 08:02 PM:

        it should be working fine ... I checked in all the changes a few hours ago and it works for me.

        Make sure you do a complete update (there are new files in the moodle/mod/* directories)

        From Gustav Delius (gwd2 at york.ac.uk) Friday, 11 July 2003, 01:28 AM:

        Unfortunately we outsiders have to wait up to 24 hours before SourceForge is kind enough to let us have the new files. >

        Now I have the new files but something weird happened: I opened moodle/backup/backup.php, got a page saying You are currently ...., pressed Continue and then was sent to the nonexisting URL moodle/backup (note no file specified). I pressed the back button on my browser and got back to moodle/backup.php which now told me that all the database stuff was completed successfully.

        So everything is fine except for the call to the nonexistent moodle/backup. The file I am using is

        $Id: backup.php,v 1.14 2003/07/09 04:43:10 moodler Exp $

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 11 July 2003, 02:04 AM:

        All seems to work fine in its new location.

        Due to a serious error in out hosting provider, I've lost my domain, so no emails will arrive to me in two days aprox.

        I'm going to refine some browser timeouts problems and start with logs restore.

        Please, put any comment about issues in this bug.

        TIA, Eloy.

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 11 July 2003, 02:23 AM:

        Hi Delius.

        I've discovered a small typo when creating database structures. It seems to be the cause of your issue. I've tried it in a 'fresh' installation and all works fine now (I think).

        updated /backup/lib.php in cvs.

        Ciao.

        From Jacob Romeyn (jacob at romeyn.org) Saturday, 19 July 2003, 09:08 AM:

        Works great overal but I found a small problem. When student have changed the picture from the default smiley it does not transfer to the new restored backup

        From Eloy Lafuente (stronk7 at moodle.org) Saturday, 19 July 2003, 08:18 PM:

        Hi, Jacob.

        Have you selected Backup User Files (in your backup) and Restore User Files (in your restore). This option deteremines when to copy user images.

        I've tested the backup/restore selecting this option and images seem to be showed correctly.

        Waiting your answer...ciao.

        From Eloy Lafuente (stronk7 at moodle.org) Sunday, 20 July 2003, 02:14 AM:

        NEWS

        ====

        • I've included some flushes to avoid browser timeout problems.
        • Now numerical questions are included too.
        • Now, I'll start polishing the frontend a bit and inclding the utility in the moodle languages system (to allow localizations...).
        • Logs restoring has been posposed to finish above.

        Use it at your risk !!!

        Ciao.

        From Martin Dougiamas (martin at moodle.com) Sunday, 20 July 2003, 10:44 PM:

        Hey Eloy!

        I need your advice! I'm just about to add a new column to the course table called visible. For now, and for future reference, can you explain the procedure for adding a new column like this wrt backup/restore?

        a) It looks like old backups can still be imported into future versions and just have default values for this column ... Is this the case?

        b) Do I just need to add an entry to backup_course_start() in http://moodle.cvs.sourceforge.net/moodle/moodle/backup/backuplib.php and restore_create_new_course() in http://moodle.cvs.sourceforge.net/moodle/moodle/backup/restorelib.php ?

        As every time I look into the backup code I am deeply impressed with the amount of work you've put into this in such a short time.

        Cheers!

        Martin

        From Eloy Lafuente (stronk7 at moodle.org) Monday, 21 July 2003, 02:37 AM:

        Ok. Here is an introduction to the backup/restore internals.

        If you want to add a new field in the course structure to the utility, first of all you musk know where to do it. If the change is in a main table, you have to modify backup/backuplib.php and backup/restorelib.php. If the change is in a module related table, you have to modify backuplib.php and restorelib.php inside the module directory.

        Second you must know what type of field you are going to add. If the field is just an attribute of the table and it is independent (not pointing to the primary key in another table, neither a 'serialized' field), simply add it in the backuplib.php with the rest of fields of the table) and add it in the restorelib.php (a bit more complicated, see below) with the rest of the fields of the table). For example, to add the 'visible' field in the course backup you must add a:

        fwrite ($bf,full_tag(VISIBLE,3,false,$course->visible));

        Where the rest of the course fields are written (in the 'backup_course_start' function).

        To restore it, just add:

        case VISIBLE:

        $this->info->course_visible = $this->getContents();

        break;

        In the 'endElementCourseHeader' function to read the value from XML and add:

        $course->visible = addslashes($course_header->course_visible);

        In the 'restore_create_new_course' to save the field to db.

        The reason of this in that writing to XML is done in a one phase process, but reading and saving to db is done in two phases.

        Restoring modules info is easier, because I use the 'infamous' xmlize function (memory eater!!) to read everything automatically from xml and there is only on required phase to save it to DB.

        All of this is to add a simple, independent field. If the field points to another table or it's a complex field (the answer field in quiz_responses, for example) or it's a serialized field (the modinfo field in course) or it needs some validation, then the above guidelines are valid to backup but insufficient to restore. After restoring, it will be necessary to to some recoding or post process of the info, saving it to the temporary backup tables if it's going to be used after that).

        And this is the first introduction to the code. I hope you understand it (my English is really awful).

        In the next post to this bug, I'll answer your a & b questions.

        Ciao.

        From Eloy Lafuente (stronk7 at moodle.org) Monday, 21 July 2003, 02:55 AM:

        Hi Martin. Abouy your questions two posts above:

        a) I think that adding new 'independent' fields to the restore maintains compatibility with old backups if you specify a default value for that field (if the ADOB library or the RDBS put that value when the field is null). I always use the insert_record, and its code seems to take care of null values, using the 'default' one if it exists.

        The backwards compatibility problem can appear when the new field a relation or serialized one, and it's a not optional one or when moodle db representation change a lot. For example, if now we create a new question type, it will not affect compatibility, because old backups doesn't have that type of questions), but if you change the way quiz_numerical are in db, backwards compatibility will be broken !!.

        b) I hope that I've answered this in my previous post !! For any question, you know where to contact me.

        And finally, two comments:

        I think that the main reason you are 'deeply impressed with the amount of work' is that this is my fist 100+ lines php script and I'm learning every day. I'm sure it can be tons of lines small.

        See you, Eloy.

        From Eloy Lafuente (stronk7 at moodle.org) Monday, 21 July 2003, 02:59 AM:

        Oh, I forgot my second comment !!

        ... smaller and BETTER. Sure !!

        I'm a simple Oracle, Java and Mac developer.

        Ciao.

        From Jacob Romeyn (jacob at romeyn.org) Tuesday, 22 July 2003, 10:45 AM:

        re my question on the pictures not restoring I had not backed them up, my mistake.

        An other observation when backing up a course. Hidden files are not backed up. At least not the chat module.

        I had two hidden chat modules installed and when I restored the file they where not present as hidden files but gone altogether.

        From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 22 July 2003, 11:17 PM:

        Hi Jacob.

        At this time, workshop and chat modules are not included in the backup/restore utility. The main reason is that they aren't 'stable' modules yet.

        I think that the rest of included modules (showed or hidden) are backuped and restored fine !!

        Now I'm working into adding language suppor to the utility. When I'll finish that, I'll start working in workshop and chat modules (I'll confirm the DB stability of them with Martin, of course).

        Sorry and ciao, Eloy.

        From Martin Dougiamas (martin at moodle.com) Tuesday, 22 July 2003, 11:26 PM:

        Just a note - I used the backup today for a real purpose - I had to create a new empty shell of a course for a new year on smec.moodle.com. I did a backup without user data and restored it to a new course - no problem at all - smooth as smooth - nice job! The Moodle interface can use a little work (ie that admin File Manager we talked about ... one day).

        I should also add that there are going to be lots of database changes over the next couple of weeks - I'll do my best to keep backup/restore functional.

        From Eloy Lafuente (stronk7 at moodle.org) Wednesday, 23 July 2003, 06:12 AM:

        Oh !! A lot of DB changes !!

        OK. I'll continue with language support...

        If you need assistance with the changes in backup..tell me.

        Ciao.

        From Eloy Lafuente (stronk7 at moodle.org) Wednesday, 23 July 2003, 06:17 AM:

        I've detected a bug in the restore process:

        When restoring a course with its modules wit user data, but only restoring course users, if a user has been unenrolled from the course some errors will appear.

        I don't know what to to. Posibilities are:

        • Precheking in the backup for needed users (course users + unenrrolled users).
        • Avoid restoring data from unenrrolled users.
        • Assigning unenrrolled data to a virtual automatically created user.

        Comments will be apreciated. TIA.

        From Eloy Lafuente (stronk7 at moodle.org) Wednesday, 30 July 2003, 03:53 AM:

        NEWS:

        =====

        • Solved two importat bugs.
        • Numerical Questions now working fine.
        • Included support to Moodle's language system.

        TODO:

        =====

        • Workshop module support.
        • Chat module support.

        COMMENTS:

        ========

        • I need some feedback about my previous post to this bug about unenrrolled users.
        • I have another question. What to do when a category exists when restoring questions:
        • Do not import the question.
        • Import the question in a new category.
        • Import the question in the existing category.
        • ????
        • Now translators can incorporate the backup/restore strings to their languages.

        This is all, ciao.

        From Eloy Lafuente (stronk7 at moodle.org) Monday, 4 August 2003, 07:06 AM:

        NEWS:

        =====

        • Updated to 0.8.6 alpha.
        • Chat modules are included in backup and restore.
        • Some changes to support large recorsets (implemeted in logs).
        • Now teachers can backup their courses and restore them (adding data to course or deleting old data first).
        • Now admins can backup their courses and restore them (adding data to course, deleting old data first or to new course), selecting any course in the site.
        • Some changes in quizzes to detect existing questions and avoid suplicating them.
        • The new course-categories schema is fully supported.
        • Added backup and restore buttons to main course page.
        • Added backup and restore buttons to moodle main page (admin box).
        • Added restore option to admin screen.

        TODO:

        =====

        • Workshop modules.

        PLEASE:

        =======

        • TEST IT and post bugs !!

        TIA, Eloy.

        From Eloy Lafuente (stronk7 at moodle.org) Monday, 4 August 2003, 07:08 AM:

        Small typo:

        • Some changes in quizzes to detect existing questions and avoid suplicating them.

        might say:

        • Some changes in quizzes to detect existing questions and avoid duplicating them.

        :-D

        From (scott.elliott at mchsi.com) Sunday, 10 August 2003, 05:18 AM:

        Random Question problem in quizzes. Backup/Restore problem?

        This may be corrected now, and actually it may not be related to the backup/restore at all (I'll do some more digging if it doesn't ring a bell).

        I did a backup from one moodle server to another. I have quizzes that had 5 random questions from 1 category and 5 from another.

        After doing a restore on the other server, if I look at a student's quiz, instead of seeing 10 different questions, I see 5 of the same question (the first one) and 5 of another question (the fifth one).

        The questions are still ok on the original server, but not on the new one.

        I might also add that I can create new quizzes in the same way on the new server without any problems.

        If this doesn't sound like a backup/restore problem let me know and I'll try to do more trouble shooting.

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 15 August 2003, 07:17 PM:

        NEWS:

        ====

        Backup/Restore now updated to 0.8.7 alpha in CVS.

        It solves some important issues restoring RANDOM and RANDOMSAMATCH questions.

        Some modifications has been done to the detection of existing questions to avoid their duplication.

        Thanks to Scott for his previous post.

        Please, confirm that the RANDOM restore issue is solved.

        TIA.

        From Eloy Lafuente (stronk7 at moodle.org) Monday, 18 August 2003, 08:21 AM:

        NEWS:

        =====

        Full support to scales:

        • Backup of scales
        • Restore of scales
        • Scales in Forums
        • Scales in Assignments.

        Updated to 0.8.8 alpha

        Please, test.

        From Greg Barnett (gregb at crowncollege.edu) Thursday, 21 August 2003, 07:04 AM:

        Instead of the error message 'put in utf8 support', it would actually be more accurate to say 'build PHP with xml support'.

        From Eloy Lafuente (stronk7 at moodle.org) Friday, 22 August 2003, 06:56 AM:

        Done. Changed 'utf8' to 'XM'L.

        From Eloy Lafuente (stronk7 at moodle.org) Saturday, 23 August 2003, 09:09 AM:

        NEWS:

        =====

        Now multianswer questions are fully supported too.

        Please, TEST them.

        TIA, Eloy.

        From Eloy Lafuente (stronk7 at moodle.org) Saturday, 23 August 2003, 11:43 PM:

        NEWS:

        ====

        • Updated to 0.8.10 alpha.
        • Backup and restore of quizzes has been changed a lot.
        • The detection of existing questions has been based in two new unique fields (stamp and version) in quiz_questions.
        • Now RANDOM and RANDOMAMATCH questions are no duplicated.

        Please, try it and inform here !!

        TIA, Eloy.

        From Eloy Lafuente (stronk7 at moodle.org) Monday, 25 August 2003, 07:17 AM:

        NEWS:

        =====

        One important change has been done to the zip library (used when backuping and restoring courses).

        It solves an important issue when restoring courses under Win32.

        Thanks to David Delgado and his effort !!

        PLEASE, testers, try it and confirm here that the restore process is working under Win32 !!

        From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 26 August 2003, 06:49 AM:

        NEWS:

        =====

        • Now workshop modules are in backup/restore too !!
        • Backup/Restore goes to 1.1 Beta 1 (first non-alpha release).
        • Some pending polishes are needed, indeed.
        • Please test everything, specially the workshop module (tons of code in two days) !!

        I'm going to close this bug (after 4 months of work!!). For any backup/restore related issues, please open new bugs.

        Bye, ciao and sayonara...

        Show
        Martin Dougiamas added a comment - From Greg Barnett (gregb at crowncollege.edu) Wednesday, 18 December 2002, 05:32 AM: In addition to being able to reset/copy/archive courses, it would be great if we could have a master version of a course, and as many simultaneous instances of the course as possible. As an example: we run a 3 week rotation for most of our classes. One class that is taught every other 3 week session is HUM125 (English Composition I). Our students taking HUM125 are split up into 3 groups. We have one group that meets in the morning (all students attend online). We have 2 classes that meet at night (one group online, the other face-to-face on our campus). We would like to have separate instances of HUM125 for each of these 3 groups. The ideal situation would be to have one main version of the course. Any changes to it would automatically apply to all current and future instances of the course (but future only would be acceptable). Any changes made to a course built from the master would trigger a popup box asking if the change should be applied to the master as well (if the teacher is listed as a teacher for the main course). We would also like to be able to choose which sections of a course are shared between all instances of a course. As an example: to reduce the possibility of cheating, we might want to modify quizzes for each instance, but to facilitate dialog, we might want some or all forums to be shared between instances. From James Miller (yositune at yahoo.com) Friday, 27 December 2002, 02:16 PM: The master/slave nuance would be very helpful. For example, I teach an info law course that sometimes is pure-play online only, and a more traditional lecture + moodle component. From Martin Dougiamas (martin at moodle.com) Thursday, 13 February 2003, 10:49 PM: I think this object-oriented inheritance approach might be better solved by the groups implementation. I'd like this bug should stay focussed on proper backups. From Martin Dougiamas (martin at moodle.com) Saturday, 1 March 2003, 04:18 PM: XML looks like the way. All the cross-referenced indexes need to be converted into some neutral and internally consistent numbering system that can be translated to fit into any Moodle server. On restore there should be matching done between usernames etc to renumber them correctly. The XML file should be saved in the course files area, so that the whole course directory can be zipped up and moved around. From Petri Asikainen (paca at sci.fi) Sunday, 2 March 2003, 12:40 AM: Should all modules have it's own backup/restore functions? At least restoring will need own logic for every module. From Martin Dougiamas (martin at moodle.com) Saturday, 22 March 2003, 10:59 AM: This is very high priority now. From Mark Berthelemy (mberthelemy at mrbeducation.co.uk) Monday, 14 April 2003, 03:42 AM: The XML structure you're suggesting to create copies of a whole Moodle course could also be used to create a SCORM compliant package - it would simply be a subset of the Moodle XML structure; containing just references to the course resources, rather than all the assignments etc. This would allow Moodle users to transfer course content created in other VLEs, or in course authoring tools that can output SCORM compliant packages (eg. Dreamweaver with the Manifest Maker extension). If you want to include Assignments and Choices in a SCORM package then Moodle will need to contain a SCORM compliant API adaptor and the Assignments etc will need to contain the correct javascript calls to the API. Probably not such a high priority at the moment... From Martin Dougiamas (martin at moodle.com) Monday, 14 April 2003, 09:59 AM: Something to keep in mind for the future, definitely. I've yet to find a real course encoded in SCORM format (there's only the very thin examples on the SCORM site) From Martin Dougiamas (martin at moodle.com) Wednesday, 16 April 2003, 06:57 PM: Eloy Lafuente (stronk7) is going to have a try at this. Go Eloy! From Martin Dougiamas (martin at moodle.com) Wednesday, 23 April 2003, 09:19 PM: Some ideas I wrote in an email a while back, which should be here for reference: My rough idea is a single script course/backup.php that allows you to select items like: x assignments x choices x forums x journals x peer graded assignments x quizzes x resources x surveys x include enrolments x include student-submitted information x include full user accounts x download the backup x compress the backup as a zip file x include uploaded files in final zip file which then creates a big xml file in the course files area with a standard naming scheme like backup-courseshortname-ddmmyyy-hhmm.xml The script can optionally create a new zip file of this backup xml file, and optionally add all the course uploaded files to the same zip, and then offer this zip as a download. Then later there would be a course/restore.php which does the same thing in reverse, roughly, allowing you to select parts that you want to restore into the current course. From Eloy Lafuente (stronk7 at moodle.org) Friday, 23 May 2003, 08:11 PM: INFORMATION FOR SUBSCRIBERS !!!! Well. I've advanced a bit since the last post to this bug. The backup interface is finished and everything is backupable (except some mods). Now I've started the restore option. When I've finished its first executable (although limited) version, I'll inform you again. Every comment will be welcome (tests included, of course). Ciao. From Eloy Lafuente (stronk7 at moodle.org) Monday, 2 June 2003, 05:19 AM: INFORMATION FOR SUBSCRIBERS !!!! Now the restore seems to work with this limitations: Logs are no restored. Only assignments, choices, resources and surveys are restored. The next step is to complete (backup and restore) missing mods (forums, quizzes and workshops). And I need some help now: 1st.) TEST, TEST, TEST and TEST !! 2nd.) It will be VERY interesting for me to have some backups (from you) to make my own tests. When I've finished new modules, I'll update this bug. Ciao. From Martin Dougiamas (martin at moodle.com) Monday, 2 June 2003, 12:01 PM: Congratulations!!! I did a very quick run through of the process - overall it looks impressive so far - very clean interface. I did run into some problems but I'll do a better test tonight and send you some backups! From Greg Barnett (gregb at crowncollege.edu) Thursday, 12 June 2003, 09:51 AM: I didn't get all the way through contrib/stronk7/backup/, due to a problem with my installation of PHP, but what I saw looks promising. I'll try again once I've recompiled PHP with utf8 support. I'm going to recommend that someplace in the code you add a few configuration checks to make sure that the users PHP/Moodle installation is capable of making backups. something like the following: if(!function_exists('utf8_encode') { error('You need to add utf8 support to your PHP installation'); } here is the output I'm getting now: Creating temporary structures Deteting old data Creating xml file Writing header Writing general info Fatal error: Call to undefined function: utf8_encode() in /var/www/html/moodle/contrib/stronk7/backup/backuplib.php on line 295 From Eloy Lafuente (stronk7 at moodle.org) Friday, 13 June 2003, 01:48 AM: Hi greb, I've included a backup_required_functions in lib.php. It's called always in backup/restore. It stops the process if something fails. Thanks. From Eloy Lafuente (stronk7 at moodle.org) Friday, 13 June 2003, 01:54 AM: Hi, everybody. I've finished the first executable version of backup/restore (backup everything, restore assignments, surveys, choices and resources). It seems to work with small/medium courses without change and with big courses doing some mysql conf. tunning (I'll try to avoid this, later). Now I'm going to develop the restore forums, quizzes and journals. Every test, comment or idea will be welcome !! TIA. From Gilberto Rodr?guez (giro at prodigy.net.mx) Thursday, 19 June 2003, 04:04 AM: Hi Eloy I'm trying this. It looks very nice. Tank's for your work. I recevie this error: Warning: mkdir() failed (No such file or directory) in /home/enlace/enlaceacademico-www/aula/contrib/stronk7/backup/lib.php on line 71 It seems to be a folder permission. What folder I need to give write permissions? From Eloy Lafuente (stronk7 at moodle.org) Friday, 20 June 2003, 04:35 AM: I need more information: Win32 or Unix ? The error occurs in backup or in restore ? Can you tell me what do you have under your $dataroot directory ? Is there a temp dir ? And inside, there is a backup dir ? What permissions do you have in the above directories ? TIA From Jacob Romeyn (jacob at romeyn.org) Friday, 20 June 2003, 07:00 AM: I have the same problem: Copying course files Zipping backup Copying zip file Warning: mkdir() failed (No such file or directory) in /home/www/moodle/contrib/stronk7/backup/lib.php on line 71 My operation system is linux RedHat 8.0 and I have : $dataroot directory ? Is there a temp dir ? And inside, there is a backup dir ? all these have permission 777. From Eloy Lafuente (stronk7 at moodle.org) Friday, 20 June 2003, 07:23 AM: Ok. The problem seems to be in backup, when copying the final file (zip) to the course area. One more (important) question. Your moodle language is set to ? TIA From Jacob Romeyn (jacob at romeyn.org) Friday, 20 June 2003, 11:26 PM: The language is set to enghlish From Gilberto Rodr?guez (giro at prodigy.net.mx) Friday, 20 June 2003, 11:40 PM: Hi, looks the same. Web Server: Apache Version 1.3.27 Operating System: Linux Redhat Version 7.3 roblem when backup-ing. I have my $datarrot outside web access with chmod 777 and works well for courses and users There is not temp or backup inside. Languaje: es From Eloy Lafuente (stronk7 at moodle.org) Friday, 20 June 2003, 11:49 PM: Ok. It seems to be two possible errors. The first, language-related, occurs when the corresponding backupdir string in the current language is incorrect to be a dirname !! The second, when you are trying to backup a course without its own dir in $dataroot (one dir is created once a course need to save any file, but it it isn't needed, the dir isn't created). All the backup process will work, but, when trying to save the backup-file to its final location (the course dir), is possible that it doesn't exist. I've to check it !! Can you confirm any of this possible errors in your installation. TIA PD: If you see that there is no course_dir under your $datarrot, you can try to upload a file with Moodle's FileManager. It'll force the creation of the dir. Please, confirm !! From Gilberto Rodr?guez (giro at prodigy.net.mx) Saturday, 21 June 2003, 12:32 AM: Success!!! The error message still appears, but the backup was created. I'll check for strings. Send you a backup image .jpg just check it's all right, look at the top of page in Attachments section. From Eloy Lafuente (stronk7 at moodle.org) Saturday, 21 June 2003, 12:52 AM: Good !! The files in the .jpg seems to be correct. But the error persists. Can you make this: 1-Can you send me a jpg (or html) with the backup progress ? 1-Go to course table and look for the id (ID) of your course. 2-Look under $dataroot and look for a dir with that ID name. Does it exist ? If not, create it by going to the Files option into the course. Does it exist now ? Backup the course and send me the result page, please !! TIA. From Gilberto Rodr?guez (giro at prodigy.net.mx) Saturday, 21 June 2003, 01:40 AM: I hope this is the image you want. All the folder exists and work, I upload files using file manager and works OK. The backup itself looks to work fine, the directory is created, and data created into it. From Gilberto Rodr?guez (giro at prodigy.net.mx) Saturday, 21 June 2003, 01:43 AM: I've also tryed in english an receive the same result. From Eloy Lafuente (stronk7 at moodle.org) Saturday, 21 June 2003, 03:57 AM: NEWS: ===== Important changes in backup/restore internals. Changed 100% db temp storage to fs temp storage. Avoid a lot of limits and timeouts. More checks are included. Now I'm going to develop the restore of the rest of modules: Journals (simple) Forums (hard work) Quizzes (HEAVY) I've included some minor debug output to check the mkdir() problem. Please, update the backup/restore utility (it must be 0.6.1 alpha) and execute the backup process again (giro and jacob). Send me the output, please. Anyway, try it and post any comment or problem. TIA. From Jacob Romeyn (jacob at romeyn.org) Saturday, 21 June 2003, 01:39 PM: I have send the backup zip to you by Email. But I still get the same error: Warning: mkdir() failed (No such file or directory) in /home/www/moodle/contrib/stronk7/backup/lib.php on line 71. And there is no way I know of to restore the file. When I start the restore.php file it can not find the zip file. From Eloy Lafuente (stronk7 at moodle.org) Saturday, 21 June 2003, 06:12 PM: Hi Jacob. I've received your backup and it seems to be restored without problems. I've included two photos (above) about your course in my test server (win2000a, win2000b). But you haven't updated the backup/restore. It has been created with 0.5.7 and it must be created with 0.6.1. The zip file generated is the same, but the new version makes more consistent checks. If, with this version, you have mkdir() problems, please save the html page (backup progress) and send me it. It includes some debug info. Final trick. If you upload the generated zip file anywhere inside the FileManager, a new Restore option must appear. Press it and enjoy restoring !!! From Jacob Romeyn (jacob at romeyn.org) Saturday, 21 June 2003, 11:50 PM: Very good everything works great. Thank you so much for this great contribution! From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 24 June 2003, 06:56 AM: NEWS: ===== Now journals and forums are restored too !! I'll start with quizzes tomorrow (hard work !!) Please, test and inform me. TIA. From Eloy Lafuente (stronk7 at moodle.org) Sunday, 29 June 2003, 07:32 AM: NEWS ==== I've splitted the quiz restore into two steps: 1.-Restore categories and questios completely. 2.-Restore quizzes itself (as a standard mod). STEP 1 is finished. I'll start STEP 2 tomorrow. Three comments: 1.-In STEP 1, I check if category exists (only by name). If it exists, I append the questions to it, else I create a new category. I'm not sure if this approach is correct (duplication of questions ?). Comments will be welcome. 2.-Any backup will be welcome to make different tests at home !! 3.-Try it, try it, try it... TIA. Ciao. From Eloy Lafuente (stronk7 at moodle.org) Monday, 30 June 2003, 07:07 AM: IMPORTANT NEWS ============== Changes done in backup utility too !! Broken compatibility with previous versions !! Please, update from cvs and try backup & restore again. New version must be 0.7 alpha !! Included STEP 2 when restoring quizzes, but NO completed !! Please, can everybody send me example backups again (done with this new release, of course). Sorry and TIA. From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 1 July 2003, 01:17 AM: I'm having some problems restoring quiz_responses, due, in part, to some error-bug-or simmilar with RANDOM questions. I'll continue as I can. See MDL-543 for more info. Ciao. From Eloy Lafuente (stronk7 at moodle.org) Thursday, 3 July 2003, 06:46 AM: NEWS: ===== New release 0.7.1 It fixes (I think) one important bug in backup when forums and assignments do not contain associated files. Thanks to Daniel Miksik and his great inform about the issue. Ciao. From Eloy Lafuente (stronk7 at moodle.org) Friday, 4 July 2003, 07:26 AM: NEWS ==== New release 0.8.0. Quizzes are included completely. Broken backup compatibility with previous versions (due to some extra info needed to restore match questions. Please, try it. If possible send me some backups to do intensive tests. TIA, Eloy. From Martin Dougiamas (martin at moodle.com) Friday, 4 July 2003, 09:46 PM: Excellent work, Eloy ... I'm just about to have a closer look into it all. First I'm going to move all the code out into the main directory as /backup so that's where you should keep working on it from now on! From Martin Dougiamas (martin at moodle.com) Friday, 4 July 2003, 10:46 PM: CVS move is in progess (I have to ask Sourceforge to do it): http://sourceforge.net/tracker/index.php?func=detail&aid=765966&group_id=1&atid=200001 From Eloy Lafuente (stronk7 at moodle.org) Saturday, 5 July 2003, 01:15 AM: Ok. I'll wait to move finished. I'm monitoring the tracker now. Ciao. From Gustav Delius (gwd2 at york.ac.uk) Wednesday, 9 July 2003, 07:58 PM: The backup module does not work from its new location in moodle/backup because the relative file locations have not yet been changed. From Martin Dougiamas (martin at moodle.com) Wednesday, 9 July 2003, 08:02 PM: it should be working fine ... I checked in all the changes a few hours ago and it works for me. Make sure you do a complete update (there are new files in the moodle/mod/* directories) From Gustav Delius (gwd2 at york.ac.uk) Friday, 11 July 2003, 01:28 AM: Unfortunately we outsiders have to wait up to 24 hours before SourceForge is kind enough to let us have the new files. > Now I have the new files but something weird happened: I opened moodle/backup/backup.php, got a page saying You are currently ...., pressed Continue and then was sent to the nonexisting URL moodle/backup (note no file specified). I pressed the back button on my browser and got back to moodle/backup.php which now told me that all the database stuff was completed successfully. So everything is fine except for the call to the nonexistent moodle/backup. The file I am using is $Id: backup.php,v 1.14 2003/07/09 04:43:10 moodler Exp $ From Eloy Lafuente (stronk7 at moodle.org) Friday, 11 July 2003, 02:04 AM: All seems to work fine in its new location. Due to a serious error in out hosting provider, I've lost my domain, so no emails will arrive to me in two days aprox. I'm going to refine some browser timeouts problems and start with logs restore. Please, put any comment about issues in this bug. TIA, Eloy. From Eloy Lafuente (stronk7 at moodle.org) Friday, 11 July 2003, 02:23 AM: Hi Delius. I've discovered a small typo when creating database structures. It seems to be the cause of your issue. I've tried it in a 'fresh' installation and all works fine now (I think). updated /backup/lib.php in cvs. Ciao. From Jacob Romeyn (jacob at romeyn.org) Saturday, 19 July 2003, 09:08 AM: Works great overal but I found a small problem. When student have changed the picture from the default smiley it does not transfer to the new restored backup From Eloy Lafuente (stronk7 at moodle.org) Saturday, 19 July 2003, 08:18 PM: Hi, Jacob. Have you selected Backup User Files (in your backup) and Restore User Files (in your restore). This option deteremines when to copy user images. I've tested the backup/restore selecting this option and images seem to be showed correctly. Waiting your answer...ciao. From Eloy Lafuente (stronk7 at moodle.org) Sunday, 20 July 2003, 02:14 AM: NEWS ==== I've included some flushes to avoid browser timeout problems. Now numerical questions are included too. Now, I'll start polishing the frontend a bit and inclding the utility in the moodle languages system (to allow localizations...). Logs restoring has been posposed to finish above. Use it at your risk !!! Ciao. From Martin Dougiamas (martin at moodle.com) Sunday, 20 July 2003, 10:44 PM: Hey Eloy! I need your advice! I'm just about to add a new column to the course table called visible. For now, and for future reference, can you explain the procedure for adding a new column like this wrt backup/restore? a) It looks like old backups can still be imported into future versions and just have default values for this column ... Is this the case? b) Do I just need to add an entry to backup_course_start() in http://moodle.cvs.sourceforge.net/moodle/moodle/backup/backuplib.php and restore_create_new_course() in http://moodle.cvs.sourceforge.net/moodle/moodle/backup/restorelib.php ? As every time I look into the backup code I am deeply impressed with the amount of work you've put into this in such a short time. Cheers! Martin From Eloy Lafuente (stronk7 at moodle.org) Monday, 21 July 2003, 02:37 AM: Ok. Here is an introduction to the backup/restore internals. If you want to add a new field in the course structure to the utility, first of all you musk know where to do it. If the change is in a main table, you have to modify backup/backuplib.php and backup/restorelib.php. If the change is in a module related table, you have to modify backuplib.php and restorelib.php inside the module directory. Second you must know what type of field you are going to add. If the field is just an attribute of the table and it is independent (not pointing to the primary key in another table, neither a 'serialized' field), simply add it in the backuplib.php with the rest of fields of the table) and add it in the restorelib.php (a bit more complicated, see below) with the rest of the fields of the table). For example, to add the 'visible' field in the course backup you must add a: fwrite ($bf,full_tag(VISIBLE,3,false,$course->visible)); Where the rest of the course fields are written (in the 'backup_course_start' function). To restore it, just add: case VISIBLE: $this->info->course_visible = $this->getContents(); break; In the 'endElementCourseHeader' function to read the value from XML and add: $course->visible = addslashes($course_header->course_visible); In the 'restore_create_new_course' to save the field to db. The reason of this in that writing to XML is done in a one phase process, but reading and saving to db is done in two phases. Restoring modules info is easier, because I use the 'infamous' xmlize function (memory eater!!) to read everything automatically from xml and there is only on required phase to save it to DB. All of this is to add a simple, independent field. If the field points to another table or it's a complex field (the answer field in quiz_responses, for example) or it's a serialized field (the modinfo field in course) or it needs some validation, then the above guidelines are valid to backup but insufficient to restore. After restoring, it will be necessary to to some recoding or post process of the info, saving it to the temporary backup tables if it's going to be used after that). And this is the first introduction to the code. I hope you understand it (my English is really awful). In the next post to this bug, I'll answer your a & b questions. Ciao. From Eloy Lafuente (stronk7 at moodle.org) Monday, 21 July 2003, 02:55 AM: Hi Martin. Abouy your questions two posts above: a) I think that adding new 'independent' fields to the restore maintains compatibility with old backups if you specify a default value for that field (if the ADOB library or the RDBS put that value when the field is null). I always use the insert_record, and its code seems to take care of null values, using the 'default' one if it exists. The backwards compatibility problem can appear when the new field a relation or serialized one, and it's a not optional one or when moodle db representation change a lot. For example, if now we create a new question type, it will not affect compatibility, because old backups doesn't have that type of questions), but if you change the way quiz_numerical are in db, backwards compatibility will be broken !!. b) I hope that I've answered this in my previous post !! For any question, you know where to contact me. And finally, two comments: I think that the main reason you are 'deeply impressed with the amount of work' is that this is my fist 100+ lines php script and I'm learning every day. I'm sure it can be tons of lines small. See you, Eloy. From Eloy Lafuente (stronk7 at moodle.org) Monday, 21 July 2003, 02:59 AM: Oh, I forgot my second comment !! ... smaller and BETTER. Sure !! I'm a simple Oracle, Java and Mac developer. Ciao. From Jacob Romeyn (jacob at romeyn.org) Tuesday, 22 July 2003, 10:45 AM: re my question on the pictures not restoring I had not backed them up, my mistake. An other observation when backing up a course. Hidden files are not backed up. At least not the chat module. I had two hidden chat modules installed and when I restored the file they where not present as hidden files but gone altogether. From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 22 July 2003, 11:17 PM: Hi Jacob. At this time, workshop and chat modules are not included in the backup/restore utility. The main reason is that they aren't 'stable' modules yet. I think that the rest of included modules (showed or hidden) are backuped and restored fine !! Now I'm working into adding language suppor to the utility. When I'll finish that, I'll start working in workshop and chat modules (I'll confirm the DB stability of them with Martin, of course). Sorry and ciao, Eloy. From Martin Dougiamas (martin at moodle.com) Tuesday, 22 July 2003, 11:26 PM: Just a note - I used the backup today for a real purpose - I had to create a new empty shell of a course for a new year on smec.moodle.com. I did a backup without user data and restored it to a new course - no problem at all - smooth as smooth - nice job! The Moodle interface can use a little work (ie that admin File Manager we talked about ... one day). I should also add that there are going to be lots of database changes over the next couple of weeks - I'll do my best to keep backup/restore functional. From Eloy Lafuente (stronk7 at moodle.org) Wednesday, 23 July 2003, 06:12 AM: Oh !! A lot of DB changes !! OK. I'll continue with language support... If you need assistance with the changes in backup..tell me. Ciao. From Eloy Lafuente (stronk7 at moodle.org) Wednesday, 23 July 2003, 06:17 AM: I've detected a bug in the restore process: When restoring a course with its modules wit user data, but only restoring course users, if a user has been unenrolled from the course some errors will appear. I don't know what to to. Posibilities are: Precheking in the backup for needed users (course users + unenrrolled users). Avoid restoring data from unenrrolled users. Assigning unenrrolled data to a virtual automatically created user. Comments will be apreciated. TIA. From Eloy Lafuente (stronk7 at moodle.org) Wednesday, 30 July 2003, 03:53 AM: NEWS: ===== Solved two importat bugs. Numerical Questions now working fine. Included support to Moodle's language system. TODO: ===== Workshop module support. Chat module support. COMMENTS: ======== I need some feedback about my previous post to this bug about unenrrolled users. I have another question. What to do when a category exists when restoring questions: Do not import the question. Import the question in a new category. Import the question in the existing category. ???? Now translators can incorporate the backup/restore strings to their languages. This is all, ciao. From Eloy Lafuente (stronk7 at moodle.org) Monday, 4 August 2003, 07:06 AM: NEWS: ===== Updated to 0.8.6 alpha. Chat modules are included in backup and restore. Some changes to support large recorsets (implemeted in logs). Now teachers can backup their courses and restore them (adding data to course or deleting old data first). Now admins can backup their courses and restore them (adding data to course, deleting old data first or to new course), selecting any course in the site. Some changes in quizzes to detect existing questions and avoid suplicating them. The new course-categories schema is fully supported. Added backup and restore buttons to main course page. Added backup and restore buttons to moodle main page (admin box). Added restore option to admin screen. TODO: ===== Workshop modules. PLEASE: ======= TEST IT and post bugs !! TIA, Eloy. From Eloy Lafuente (stronk7 at moodle.org) Monday, 4 August 2003, 07:08 AM: Small typo: Some changes in quizzes to detect existing questions and avoid suplicating them. might say: Some changes in quizzes to detect existing questions and avoid duplicating them. :-D From (scott.elliott at mchsi.com) Sunday, 10 August 2003, 05:18 AM: Random Question problem in quizzes. Backup/Restore problem? This may be corrected now, and actually it may not be related to the backup/restore at all (I'll do some more digging if it doesn't ring a bell). I did a backup from one moodle server to another. I have quizzes that had 5 random questions from 1 category and 5 from another. After doing a restore on the other server, if I look at a student's quiz, instead of seeing 10 different questions, I see 5 of the same question (the first one) and 5 of another question (the fifth one). The questions are still ok on the original server, but not on the new one. I might also add that I can create new quizzes in the same way on the new server without any problems. If this doesn't sound like a backup/restore problem let me know and I'll try to do more trouble shooting. From Eloy Lafuente (stronk7 at moodle.org) Friday, 15 August 2003, 07:17 PM: NEWS: ==== Backup/Restore now updated to 0.8.7 alpha in CVS. It solves some important issues restoring RANDOM and RANDOMSAMATCH questions. Some modifications has been done to the detection of existing questions to avoid their duplication. Thanks to Scott for his previous post. Please, confirm that the RANDOM restore issue is solved. TIA. From Eloy Lafuente (stronk7 at moodle.org) Monday, 18 August 2003, 08:21 AM: NEWS: ===== Full support to scales: Backup of scales Restore of scales Scales in Forums Scales in Assignments. Updated to 0.8.8 alpha Please, test. From Greg Barnett (gregb at crowncollege.edu) Thursday, 21 August 2003, 07:04 AM: Instead of the error message 'put in utf8 support', it would actually be more accurate to say 'build PHP with xml support'. From Eloy Lafuente (stronk7 at moodle.org) Friday, 22 August 2003, 06:56 AM: Done. Changed 'utf8' to 'XM'L. From Eloy Lafuente (stronk7 at moodle.org) Saturday, 23 August 2003, 09:09 AM: NEWS: ===== Now multianswer questions are fully supported too. Please, TEST them. TIA, Eloy. From Eloy Lafuente (stronk7 at moodle.org) Saturday, 23 August 2003, 11:43 PM: NEWS: ==== Updated to 0.8.10 alpha. Backup and restore of quizzes has been changed a lot. The detection of existing questions has been based in two new unique fields (stamp and version) in quiz_questions. Now RANDOM and RANDOMAMATCH questions are no duplicated. Please, try it and inform here !! TIA, Eloy. From Eloy Lafuente (stronk7 at moodle.org) Monday, 25 August 2003, 07:17 AM: NEWS: ===== One important change has been done to the zip library (used when backuping and restoring courses). It solves an important issue when restoring courses under Win32. Thanks to David Delgado and his effort !! PLEASE, testers, try it and confirm here that the restore process is working under Win32 !! From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 26 August 2003, 06:49 AM: NEWS: ===== Now workshop modules are in backup/restore too !! Backup/Restore goes to 1.1 Beta 1 (first non-alpha release). Some pending polishes are needed, indeed. Please test everything, specially the workshop module (tons of code in two days) !! I'm going to close this bug (after 4 months of work!!). For any backup/restore related issues, please open new bugs. Bye, ciao and sayonara...
        Hide
        Michael Blake added a comment -

        assign to a valid user

        Show
        Michael Blake added a comment - assign to a valid user

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: