Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-26587

Some backups do restore on Mysql but not on postgres (some kind of issue with empty itemid)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.2, 2.1.4, 2.2.1
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Backup
    • Labels:

      Description

      Try to restore this course on postgres: http://hub.moodle.org/local/hub/webservice/download.php?courseid=46&filetype=backup&remotemoodleurl=http%3A%2F%2Fhub.moodle.org

      After perform restore button you see:

      Debug info: ERROR: invalid input syntax for integer: ""
      SELECT * FROM mdl_backup_ids_temp WHERE backupid = $1 AND itemname = $2 AND itemid = $3
      [array (
      0 => 'e9e378ea1e5dd0a80eac3ca55300f321',
      1 => 'question_answer',
      2 => '',
      )]Stack trace:line 391 of /lib/dml/moodle_database.php: dml_read_exception thrownline 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()line 672 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()line 1256 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()line 1228 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()line 1208 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()line 1257 of /backup/util/dbops/restore_dbops.class.php: call to moodle_database->get_record()line 210 of /backup/util/plan/restore_structure_step.class.php: call to restore_dbops::get_backup_ids_record()line 202 of /backup/util/plan/restore_structure_step.class.php: call to restore_structure_step->get_mapping()line 179 of /backup/moodle2/restore_plugin.class.php: call to restore_structure_step->get_mappingid()line 73 of /question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php: call to restore_plugin->get_mappingid()line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_qtype_shortanswer_plugin->process_shortanswer()line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()line 106 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()line 132 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()line ? of unknownfile: call to progressive_parser->end_tag()line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()line 299 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()line 144 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()line 39 of /backup/restore.php: call to restore_ui->execute()

      The error (discovered by Apu) is due to postgres wanting a integer and receving ''. Let me know if the backup if faulty because the backup comes from Mooch.

      Thank you.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            mkelly Mike Kelly added a comment -

            I can replicate this error. We're seeing it when we try and migrate a backup of a course from our trial to production Moodle 2.0.2 servers:

            Default exception handler: Error reading from database Debug: ERROR: invalid input syntax for integer: ""
            SELECT * FROM mdl_backup_ids_temp WHERE backupid = $1 AND itemname = $2 AND itemid = $3
            [array (
            0 => 'f8be9c1aeb9f87be0ad69e0cbcc41e98',
            1 => 'question_answer',
            2 => '',
            )]

            • line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
            • line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
            • line 678 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
            • line 1256 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
            • line 1228 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
            • line 1208 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
            • line 1257 of /backup/util/dbops/restore_dbops.class.php: call to moodle_database->get_record()
            • line 213 of /backup/util/plan/restore_structure_step.class.php: call to restore_dbops::get_backup_ids_record()
            • line 205 of /backup/util/plan/restore_structure_step.class.php: call to restore_structure_step->get_mapping()
            • line 182 of /backup/moodle2/restore_plugin.class.php: call to restore_structure_step->get_mappingid()
            • line 73 of /question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php: call to restore_plugin->get_mappingid()
            • line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_qtype_shortanswer_plugin->process_shortanswer()
            • line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
            • line 106 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
            • line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
            • line 132 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
            • line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
            • line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
            • line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
            • line ? of unknownfile: call to progressive_parser->end_tag()
            • line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
            • line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
            • line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
            • line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
            • line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
            • line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
            • line 299 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
            • line 144 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
            • line 39 of /backup/restore.php: call to restore_ui->execute()
            Show
            mkelly Mike Kelly added a comment - I can replicate this error. We're seeing it when we try and migrate a backup of a course from our trial to production Moodle 2.0.2 servers: Default exception handler: Error reading from database Debug: ERROR: invalid input syntax for integer: "" SELECT * FROM mdl_backup_ids_temp WHERE backupid = $1 AND itemname = $2 AND itemid = $3 [array ( 0 => 'f8be9c1aeb9f87be0ad69e0cbcc41e98', 1 => 'question_answer', 2 => '', )] line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end() line 678 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end() line 1256 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql() line 1228 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql() line 1208 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select() line 1257 of /backup/util/dbops/restore_dbops.class.php: call to moodle_database->get_record() line 213 of /backup/util/plan/restore_structure_step.class.php: call to restore_dbops::get_backup_ids_record() line 205 of /backup/util/plan/restore_structure_step.class.php: call to restore_structure_step->get_mapping() line 182 of /backup/moodle2/restore_plugin.class.php: call to restore_structure_step->get_mappingid() line 73 of /question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php: call to restore_plugin->get_mappingid() line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_qtype_shortanswer_plugin->process_shortanswer() line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process() line 106 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk() line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk() line 132 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk() line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk() line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk() line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish() line ? of unknownfile: call to progressive_parser->end_tag() line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse() line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse() line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process() line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute() line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute() line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute() line 299 of /backup/controller/restore_controller.class.php: call to restore_plan->execute() line 144 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan() line 39 of /backup/restore.php: call to restore_ui->execute()
            Hide
            paca70 Petri Asikainen added a comment -

            I'm seeing same issue here, when restoring backups created with 2.1.2 version (mysql) and trying to restore 2.2_weekly_stable (postgresql).

            Show
            paca70 Petri Asikainen added a comment - I'm seeing same issue here, when restoring backups created with 2.1.2 version (mysql) and trying to restore 2.2_weekly_stable (postgresql).
            Hide
            paca70 Petri Asikainen added a comment -

            Fixed this issue with following patch (it's created agaist curret MOODLE_22_STABLE)

            Index: question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php
            ===================================================================
            RCS file: /cvsroot/moodle/moodle/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php,v
            retrieving revision 1.2
            diff -u -r1.2 restore_qtype_shortanswer_plugin.class.php
            — question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php 9 Jun 2011 02:10:09 -0000 1.2
            +++ question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php 7 Feb 2012 06:57:06 -0000
            @@ -75,6 +75,10 @@
            // Map sequence of question_answer ids
            $answersarr = explode(',', $data->answers);
            foreach ($answersarr as $key => $answer) {
            + //Postgresql does not handle empty strings as integer values
            + if ($answer == '')

            { + $answer = null; + }

            $answersarr[$key] = $this->get_mappingid('question_answer', $answer);
            }
            $data->answers = implode(',', $answersarr);

            Show
            paca70 Petri Asikainen added a comment - Fixed this issue with following patch (it's created agaist curret MOODLE_22_STABLE) Index: question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php,v retrieving revision 1.2 diff -u -r1.2 restore_qtype_shortanswer_plugin.class.php — question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php 9 Jun 2011 02:10:09 -0000 1.2 +++ question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php 7 Feb 2012 06:57:06 -0000 @@ -75,6 +75,10 @@ // Map sequence of question_answer ids $answersarr = explode(',', $data->answers); foreach ($answersarr as $key => $answer) { + //Postgresql does not handle empty strings as integer values + if ($answer == '') { + $answer = null; + } $answersarr [$key] = $this->get_mappingid('question_answer', $answer); } $data->answers = implode(',', $answersarr);
            Hide
            paca70 Petri Asikainen added a comment -

            Fix for Moodle 2.2

            Show
            paca70 Petri Asikainen added a comment - Fix for Moodle 2.2
            Hide
            nebgor Aparup Banerjee added a comment -

            thanks Petri, i've added the patch label now.

            Show
            nebgor Aparup Banerjee added a comment - thanks Petri, i've added the patch label now.
            Hide
            paca70 Petri Asikainen added a comment -

            please add also 2.1 and 2.2 as affected versions.

            Show
            paca70 Petri Asikainen added a comment - please add also 2.1 and 2.2 as affected versions.
            Hide
            nebgor Aparup Banerjee added a comment -

            yup added

            Show
            nebgor Aparup Banerjee added a comment - yup added
            Hide
            nebgor Aparup Banerjee added a comment - - edited

            Petri do you want to try out making this patch in git?
            that way you can simply be the patch author
            Its not too difficult, you can see http://docs.moodle.org/dev/Git_for_developers

            if not i'll pick n push this up tomorrow in a git patch crediting you.

            Show
            nebgor Aparup Banerjee added a comment - - edited Petri do you want to try out making this patch in git? that way you can simply be the patch author Its not too difficult, you can see http://docs.moodle.org/dev/Git_for_developers if not i'll pick n push this up tomorrow in a git patch crediting you.
            Hide
            paca70 Petri Asikainen added a comment - - edited

            Go ahead.
            Right now I have no time to setup git. Maybe later.
            There's an other backup/restore and postgresql related issue
            http://tracker.moodle.org/browse/MDL-31532 I have provided patch
            also for that.

            Show
            paca70 Petri Asikainen added a comment - - edited Go ahead. Right now I have no time to setup git. Maybe later. There's an other backup/restore and postgresql related issue http://tracker.moodle.org/browse/MDL-31532 I have provided patch also for that.
            Hide
            crafton Crafton Williams added a comment -

            Hi,

            Is there a plan to integrate this patch to stable branch?

            Show
            crafton Crafton Williams added a comment - Hi, Is there a plan to integrate this patch to stable branch?
            Hide
            nebgor Aparup Banerjee added a comment -

            ah just re-noticed this.
            up for peer-review..

            integrator : please cherry-pick to 22 and 21.

            Show
            nebgor Aparup Banerjee added a comment - ah just re-noticed this. up for peer-review.. integrator : please cherry-pick to 22 and 21.
            Hide
            nebgor Aparup Banerjee added a comment -

            sorry, was just playing with jira here.. back to waiting for peer-review now.

            Show
            nebgor Aparup Banerjee added a comment - sorry, was just playing with jira here.. back to waiting for peer-review now.
            Hide
            poltawski Dan Poltawski added a comment -

            Sorry, only just saw was assigned to me. I think its for Tim though.

            Show
            poltawski Dan Poltawski added a comment - Sorry, only just saw was assigned to me. I think its for Tim though.
            Hide
            timhunt Tim Hunt added a comment -

            I am not sure I would describe that as a solution. An aswere id should never be null, or an empty string. Something is badly wrong.

            The suggested patch may hide the real error, and make the symptoms go away, but that is not a step forwards.

            Can anyone give us a way to reproduce the underlying problem. In other words, can you attach one small backup file (one quiz, one question), such that restoring the backup generates the error message given here?

            Show
            timhunt Tim Hunt added a comment - I am not sure I would describe that as a solution. An aswere id should never be null, or an empty string. Something is badly wrong. The suggested patch may hide the real error, and make the symptoms go away, but that is not a step forwards. Can anyone give us a way to reproduce the underlying problem. In other words, can you attach one small backup file (one quiz, one question), such that restoring the backup generates the error message given here?
            Hide
            nebgor Aparup Banerjee added a comment -

            Tim, the 'Film Studies' course in the link in description (downloadable form mooch hub) still replicates the issue for me in 2.4dev.

            i'll try to create a backup again that does replicate this narrowly. 'An answer id should never be null, or an empty string.' makes sense to me - i had thought 'Film Studies' was an old backup (where answerid could've been null) file that had lost backward compatibility. i'm not sure how easy it will be to investigate how it was created with the little info we have to go on. so imo this is a step forwards in the form of moving on.

            so this patch was about trying to cure something of which i've no idea how it came about. hence, solving the symptom.

            hm, is there a way to see in what build of moodle a backup was created?

            ah just looked at the file:
            ..<moodle_version>2010100900</moodle_version><moodle_release>2.0 RC1 (Build: 20101011)</moodle_release><backup_version>2010092100</backup_version><backup_release>2.0 RC1</backup_release><backup_date>1286782789</backup_date>..

            so it might be a 2.0 thing that was fixed or some source problem still around. will look into this some more.

            Show
            nebgor Aparup Banerjee added a comment - Tim, the 'Film Studies' course in the link in description (downloadable form mooch hub) still replicates the issue for me in 2.4dev. i'll try to create a backup again that does replicate this narrowly. 'An answer id should never be null, or an empty string.' makes sense to me - i had thought 'Film Studies' was an old backup (where answerid could've been null) file that had lost backward compatibility. i'm not sure how easy it will be to investigate how it was created with the little info we have to go on. so imo this is a step forwards in the form of moving on. so this patch was about trying to cure something of which i've no idea how it came about. hence, solving the symptom. hm, is there a way to see in what build of moodle a backup was created? ah just looked at the file: ..<moodle_version>2010100900</moodle_version><moodle_release>2.0 RC1 (Build: 20101011)</moodle_release><backup_version>2010092100</backup_version><backup_release>2.0 RC1</backup_release><backup_date>1286782789</backup_date>.. so it might be a 2.0 thing that was fixed or some source problem still around. will look into this some more.
            Hide
            nebgor Aparup Banerjee added a comment -

            i'm attaching a backup attempting to narrow down what the question could be storing as a null.

            witha single wildcard * , i can accept answers that have nothing typed in. not sure if thats a problem but the backup isn't replicating the issue.

            It would be cool to have just that one question thats causing this issue.

            Show
            nebgor Aparup Banerjee added a comment - i'm attaching a backup attempting to narrow down what the question could be storing as a null. witha single wildcard * , i can accept answers that have nothing typed in. not sure if thats a problem but the backup isn't replicating the issue. It would be cool to have just that one question thats causing this issue.
            Hide
            nebgor Aparup Banerjee added a comment -

            ok, after looking through UI and backup and this restore bit (patch provided) i've come to conclude that i cannot replicate this broken data. There are concerns however;

            I think there are some issues here that need to be addressed separately:

            • attempting to restore mbz data from whatever version will infuture likely incur some bugs, we need a way to handle this properly, either
            1. totally blocking such data lacking integrity at some level and moving forward without the whole data, therefore denying data without integrity or
            2. that the system tries to restore as much as it can while remembering what integrity issues there are with the data it encounters and thereafter direct the admin to note or even handle (more ui) data lacking total integrity. This would be a lot of work, and so i'll create another issue for this.
              (ps:i prefer 2)
            • i can't replicate creating a backup from any moodle 2.x stable version to contain (from the Film Studies .mbz):

              <question id="119"><parent>0</parent><name>Translating  'fear'</name><questiontext><div class="text_to_html">In the questions on emotion and sci-fi, horror and fantasy, you were asked to decide if those genres could arouse eight emotions.  Because your first language is not English (as far as I know before meeting you all/until you tell me online) it is interesting, and may be important, to see if we all, more or less, agree in our understandings of the words we will use to discuss emotions.  <br />
              In this question, to which there are unlikely to be right or wrong answers, I ask you to provide a Danish translation of your understanding of the emotion word **fear**.</div></questiontext><questiontextformat>1</questiontextformat><generalfeedback/><generalfeedbackformat>1</generalfeedbackformat><defaultgrade>1.0000000</defaultgrade><penalty>0.1000000</penalty><qtype>shortanswer</qtype><length>1</length><stamp>moodle.gla.ac.uk+050227094148+8tffEj</stamp><version>5</version><hidden>0</hidden><timecreated>0</timecreated><timemodified>0</timemodified><createdby>$@NULL@$</createdby><modifiedby>$@NULL@$</modifiedby>
               
              <plugin_qtype_shortanswer_question>
               <answers> </answers>
              <shortanswer id="18">
               <answers/>
               <usecase>0</usecase>
              </shortanswer>
              </plugin_qtype_shortanswer_question>
               
              </question>

              This may or may not be an issue still with the latest stable moodle versions, i haven't been able to replicate it. If it is then a fix will be needed for them. If not simply upgrading to the latest for that version would resolve these broken backups being created.
              For further investigation and confirmation, i'm creating another issue.

            ok. so anyway this is up for peer-review - a better check for empty answers and more explanatory.

            ps: i've just verified on coolcourses.moodle.org's database that course 'Film Studies' question(id=119) really doesn't have anything associated with it (question_answers), so this seems to be a case of gui letting thru some data breakage. we really shouldn't block it form restore.

            Show
            nebgor Aparup Banerjee added a comment - ok, after looking through UI and backup and this restore bit (patch provided) i've come to conclude that i cannot replicate this broken data. There are concerns however; I think there are some issues here that need to be addressed separately: attempting to restore mbz data from whatever version will infuture likely incur some bugs, we need a way to handle this properly, either totally blocking such data lacking integrity at some level and moving forward without the whole data, therefore denying data without integrity or that the system tries to restore as much as it can while remembering what integrity issues there are with the data it encounters and thereafter direct the admin to note or even handle (more ui) data lacking total integrity. This would be a lot of work, and so i'll create another issue for this. (ps:i prefer 2) i can't replicate creating a backup from any moodle 2.x stable version to contain (from the Film Studies .mbz): <question id="119"><parent>0</parent><name>Translating 'fear'</name><questiontext><div class="text_to_html">In the questions on emotion and sci-fi, horror and fantasy, you were asked to decide if those genres could arouse eight emotions. Because your first language is not English (as far as I know before meeting you all/until you tell me online) it is interesting, and may be important, to see if we all, more or less, agree in our understandings of the words we will use to discuss emotions. <br /> In this question, to which there are unlikely to be right or wrong answers, I ask you to provide a Danish translation of your understanding of the emotion word **fear**.</div></questiontext><questiontextformat>1</questiontextformat><generalfeedback/><generalfeedbackformat>1</generalfeedbackformat><defaultgrade>1.0000000</defaultgrade><penalty>0.1000000</penalty><qtype>shortanswer</qtype><length>1</length><stamp>moodle.gla.ac.uk+050227094148+8tffEj</stamp><version>5</version><hidden>0</hidden><timecreated>0</timecreated><timemodified>0</timemodified><createdby>$@NULL@$</createdby><modifiedby>$@NULL@$</modifiedby>   <plugin_qtype_shortanswer_question> <answers> </answers> <shortanswer id="18"> <answers/> <usecase>0</usecase> </shortanswer> </plugin_qtype_shortanswer_question>   </question> This may or may not be an issue still with the latest stable moodle versions, i haven't been able to replicate it. If it is then a fix will be needed for them. If not simply upgrading to the latest for that version would resolve these broken backups being created. For further investigation and confirmation, i'm creating another issue. ok. so anyway this is up for peer-review - a better check for empty answers and more explanatory. ps: i've just verified on coolcourses.moodle.org's database that course 'Film Studies' question(id=119) really doesn't have anything associated with it (question_answers), so this seems to be a case of gui letting thru some data breakage. we really shouldn't block it form restore.
            Hide
            timhunt Tim Hunt added a comment -

            I'll try to look at this tomorrow.

            Show
            timhunt Tim Hunt added a comment - I'll try to look at this tomorrow.
            Hide
            nebgor Aparup Banerjee added a comment -

            i've pushed one more commit as an after thought - its hacky , so picking/improving it would be at integrators discretion.
            one issue is i don't know how to get the course id for the course/cmid being restored.

            Show
            nebgor Aparup Banerjee added a comment - i've pushed one more commit as an after thought - its hacky , so picking/improving it would be at integrators discretion. one issue is i don't know how to get the course id for the course/cmid being restored.
            Hide
            nebgor Aparup Banerjee added a comment -

            ah the courseid is accessible via $this->task->get_courseid() BUT the url is always under a /mod when using add_to_log() so i've removed this commit. nothing nice here.

            back to just the one commit.

            Show
            nebgor Aparup Banerjee added a comment - ah the courseid is accessible via $this->task->get_courseid() BUT the url is always under a /mod when using add_to_log() so i've removed this commit. nothing nice here. back to just the one commit.
            Hide
            timhunt Tim Hunt added a comment -

            That looks like a good fix.

            question_shortanswer.answers is hardly used for anything. It is a legacy thing that should be removed. So, I am not very worried if it is blank in old bad data. Also, it will get fixed the first time the restored question is edited.

            So, if this small change is all that is required to make the restore work, then please go ahead and submit it for integration.

            Show
            timhunt Tim Hunt added a comment - That looks like a good fix. question_shortanswer.answers is hardly used for anything. It is a legacy thing that should be removed. So, I am not very worried if it is blank in old bad data. Also, it will get fixed the first time the restored question is edited. So, if this small change is all that is required to make the restore work, then please go ahead and submit it for integration.
            Hide
            nebgor Aparup Banerjee added a comment -

            Thanks Tim, up now for picking(one commit). Jira dialogs are crazy on an iPhone

            Show
            nebgor Aparup Banerjee added a comment - Thanks Tim, up now for picking(one commit). Jira dialogs are crazy on an iPhone
            Hide
            poltawski Dan Poltawski added a comment -

            Integrated to 22, 23 and master. Thanks Apu

            Show
            poltawski Dan Poltawski added a comment - Integrated to 22, 23 and master. Thanks Apu
            Hide
            rwijaya Rossiani Wijaya added a comment -

            This looks good.

            Test passed.

            Show
            rwijaya Rossiani Wijaya added a comment - This looks good. Test passed.
            Hide
            poltawski Dan Poltawski added a comment -

            *Notice*: Undefined variable: friendlyintegrator in /Users/danp/git/tokenintegrationthanks.php on line 26

            Congratulations

            {tracker.user.name}

            !

            You've made into Moodle

            {tracker.fixversion-1}

            +

            I would like to personally thank you for this contribution on behalf of all Moodle users throughout the world.

            cheers!

            {tracker.friendlyintegrator}
            Show
            poltawski Dan Poltawski added a comment - * Notice *: Undefined variable: friendlyintegrator in /Users/danp/git/tokenintegrationthanks.php on line 26 Congratulations {tracker.user.name} ! You've made into Moodle {tracker.fixversion-1} + I would like to personally thank you for this contribution on behalf of all Moodle users throughout the world. cheers! {tracker.friendlyintegrator}

              People

              • Votes:
                4 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Sep/12