Questionnaire: bug in backup/restore?

Questionnaire: bug in backup/restore?

by Miroslav Fikar -
Number of replies: 15
I use the latest Moodle and Questionnaire module and tried to backup a questionnaire from one course and restore it at a different server. My questionnaire is not written in English. The restored questionnaire has some of the codings corrupted: the questions and alternatives.

The original part of the webpage:
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
<title>: Editing questionnaire</title>
<input type="text" size="60" name="choice_content_1"
value="uitočnosť">
<input type="text" size="60" name="choice_content_2"
value="rozsah-náročnosť">

The same for the restored webpage:
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
<title>: Editing questionnaire</title>
<input type="text" size="60" name="choice_content_1"
value="uÂitoènosÂť">
<input type="text" size="60" name="choice_content_2"
value="rozsah-nåroènos">


Average of ratings: -
In reply to Miroslav Fikar

Re: Questionnaire: bug in backup/restore?

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
Hi Miroslav -

I have just updated the backup/restore code with a fix that should solve your problem. Get the latest version from CVS or from the downloads page.

mike
In reply to Mike Churchward

Re: Questionnaire: bug in backup/restore?

by Miroslav Fikar -
Hi, Mike,
Well, for some reason, I cannot restore my questionnaire anymore. At first, I thought, it is the new restorelib.php. But it does not work neither with the restorelib with version (1.4 2005/12/02 01:02:39 mchurch) nor with the newer one. The restore process chokes on questionnaire; if I exclude it from restore, everything goes ok. I will try to debug it to find out, what happens.
Miro
In reply to Miroslav Fikar

Re: Questionnaire: bug in backup/restore?

by Graham Yarrow -

Hi Miroslav/Mike,  Here at Warwickshire College we are currently evaluating Moodle against WebCT CE6.  We like the Questionnaire module very much in Moodle but we have a problem with it when moving servers that might prevent us from moving to Moodle.  We're having the same problem that Miroslav has described.  We have found that we cannot move questionnaires from a moodle installation on one server to a moodle installation on another server.

The way we moved servers was by moving our moodle/ and moodledata/ folders over (with all necessary permissions) from the old server to the new server.  We then backed up the Moodle MySql database on our old server and restored it in MySQL to the new server.  We run IIS6 on Windows 2003 Server.  We have also tried backing up the questionnaires individually from within moodle and then try restoring them to Moodle on the new server - however this restore always fails (with a very brief and unhelpful error message).

When we try browse to the qustionnaire on the new server the questionnaire does not display and we get an error message in a pink rectangular box which reads "The module is incorrect".  If we go to warkscol » Administration » Configuration » Modules on the new server the number of activities listed for Questionnaires reads 0 when it should read 7.

We have tried  upgrading our Questionnaire module to the very latest version (as of 13/02/2006) and the problem stil exists.  Do you know why this is and how we can get arround this problem.  Your help would be much appreciated. 

Thanks, Graham.

In reply to Graham Yarrow

Re: Questionnaire: bug in backup/restore?

by Miroslav Fikar -
I have tried to investigate the issue with Mike privately, but we did not go very far. It seemed that theoretically the error cannot occur. So I thought that I did some error when creating the questionnaire.

However, afterwards I found that if the user data are ommited, the restore process finishes successfully. And I did not need to restore the user data - only the questionnaire structure, so that I did not pursue the issue any more.

But of course, if I copy the whole site using sqldump, the questionnaire is OK (this is the exact copy procedure). Only the user way : Teacher (backup/restore) did not work.

Best,
Miro

In reply to Miroslav Fikar

Re: Questionnaire: bug in backup/restore?

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
Hi Miro -

So, what youy've found is that the problem exists in the user data restore part, is that correct? I will dig into this.

mike
In reply to Mike Churchward

Re: Questionnaire: bug in backup/restore?

by Miroslav Fikar -
Hi Mike,
yes, it was the return of the function questionnaire_attempts_restore_mods at line 127 (version 1.4, file restorelib.php). So if I omitted user data, everything went smoothly. I do not remember it exactly, but it was either response_single or _multiple that was somehow uncomplete.
I did not try it with the newest version of the module as it appeared buggy from the responses.
Miro

In reply to Miroslav Fikar

Re: Questionnaire: bug in backup/restore?

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
Hi Miro -

There are some bugs being ironed out, but you can still use the latest 'restorelib.php'. It would be great if you could try again and let me know if the problem still exists.

mike
In reply to Mike Churchward

Re: Questionnaire: bug in backup/restore?

by Miroslav Fikar -
Unfortunately, yes. I took the latest questionnaire.zip from downloads, saved the course and restored it. It ended with the same error. I will send you the course backup privately (contains now questionnaire only), so that you can try to restore it by yourself and see if it occurs as well.

Miro
In reply to Miroslav Fikar

Re: Questionnaire: bug in backup/restore?

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
Hi Miro -

It would be great if you could send me the backup.

mike
In reply to Miroslav Fikar

Re: Questionnaire: bug in backup/restore?

by Graham Yarrow -

Hi Miro,

Ideally, we need to restore the data (i.e. the questionnaire responses) AND the questionnaire itself - however, I have tried just restoring the questionnaire (without the data) and this failed in the same way - with the following error message when you try to access the questionnaire...

You will see from the attached screenshot that the questionnaire itself appears with two strange boxes adjacent to it (see below).

Miro, I am very interested in your comments about 'copying the whole site using sqldump (the exact copy procedure)' - I have never heard of this before, what is this method? what do I need to do it and how do I do it?

The method I've been using up until now - to back up and restore our entire Moodle database - is by using the MySQL Administrator tools backup and restore features.  This method is perfect at backing up and restoring to the same machine - however, when you backup from one machine and restore to a different machine, the questionnaire module fails with the above errors.

We tend to move servers an awful lot here - therefore I need a reliable method for moving our entire Moodle installation intact.  Any further suggestions...?

Thanks,
Graham.

In reply to Graham Yarrow

Re: Questionnaire: bug in backup/restore?

by Miroslav Fikar -
I have a production server of Linux and one test machine on Windows. This is what I do to have a mirror on the Windows machine.
  1. rsync /moodle and /moodledata directories and overwrite /moodle/config.php on Windows to reflect different paths
  2. mysqldump  > file.sql (on Linux, with some options to select the databases,...)
  3. mysql.exe < file.sql (on Windows)
But I suspect that this method is not perfect and some of the links can be incorrect in the destination, but that could be solved by searching/replacing directly in the file.sql. Moreover, all steps should be done together on frozen servers so that there are no transaction between.

In this way, I am also able to restore the questionnaire with data.


Hope it helps,
Miro
In reply to Miroslav Fikar

Re: Questionnaire: bug in backup/restore?

by Graham Yarrow -

Miro, how are you running your sqldump...? is it run directly from the MySQL command line interface...?  I don't usually use the Command Line Interface I usually use the MySQL Administrator GUI tool.  I'm not sure what you mean by 'links can be incorrect in the destination'... - please give an example.  Not sure what you mean by 'frozen server' either.

Mike/Miro - I'm also quite concerned about those small characters that look like small boxes (squares) that appear alongside my questionnaires - please take a look at the upper of the two screenshots in my image attachment in my earlier post above - you will see two small boxes on the far right hand side.  I see strange boxes appear throughout Moodle (not just the questionnaire section.  They are also hyperlinked - when you click them it takes you to the smae page that you're currently viewing.

Your thoughts...?

In reply to Graham Yarrow

Re: Questionnaire: bug in backup/restore?

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
Those are highlight boxes. If you have multiple sections in your course (topics or weeks), clicking on a single box causes the display to show only that section, while clicking on the double boxes shows all sections. If you have only one section, nothing really interesting happens.

mike
In reply to Mike Churchward

Re: Questionnaire: bug in backup/restore?

by Graham Yarrow -
OK thanks Mike - also - would it be useful for me to send you my SQL dump...? to figure out why questionnaires do not work after being restored to a new server?
In reply to Graham Yarrow

Re: Questionnaire: bug in backup/restore?

by Miroslav Fikar -
To dump the database, I use command line tools (mysqldump). However, that is entirely equivalent to GUI tools - only faster if you do it frequently and from a batch file.
However, it should be synchronised with the content of /moodledata directory - you should consider to block web access between sqldump and backup of /moodledata so that nothing happens. That was what I called in my poor English "frozen server".
About the possible links in the mirror server: for example this can happen if there are absolute links (written by users manually) on the source server pointing to some other part of the course. If these are stored in the database in text/blob entry, they will not be translated to a correct location on the mirror server - instead they will still point to the source server. Therefore, it might be necessary to search/replace the sqldump file for such occurences.
I hope it helps.
Miro