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

modifiedby and timemodified not set during questions import

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.13, 2.0.4, 2.1.1, 2.2
    • Fix Version/s: 1.9.14, 2.0.5, 2.1.2
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      Use any format to import some questions. No need to look at the database, just go to the question bank page, imported question don't display any name for the "last modification by" column

      Show
      Use any format to import some questions. No need to look at the database, just go to the question bank page, imported question don't display any name for the "last modification by" column
    • Workaround:
      Hide

      Fix :
      just add the 2 missing lines :
      $question->modifiedby = $USER->id;
      $question->timemodified = time();

      Show
      Fix : just add the 2 missing lines : $question->modifiedby = $USER->id; $question->timemodified = time();
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      As the title says the modifiedby and timemodified fields of the question table are not set during questions import.
      This affect all imports and all Moodle versions since at least 1.9 (I have not looked in previous versions)
      This is because of the code

                  $question->createdby = $USER->id;
                  $question->timecreated = time();
       
                  if (!$question->id = insert_record("question", $question)) {
                      error( get_string('cannotinsert','quiz') );
                  }

      in Moodle 1.9
      and

                  $question->createdby = $USER->id;
                  $question->timecreated = time();
       
                  $question->id = $DB->insert_record('question', $question);

      in Moodle 2.0/2.1
      this code is in the function importprocess of the question/format.php
      lines 395-398 for Moodle 2.1
      lines 349-352 for Moodle 2.0
      lines 325-330 for Moodle 1.9
      I guess this is so minor that nobody ever noticed it. And it doesn't break anything I think !

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            timhunt Tim Hunt added a comment -

            Integrators, please note:

            Integrate MDL-28438 first!

            Show
            timhunt Tim Hunt added a comment - Integrators, please note: Integrate MDL-28438 first!
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Integrated, thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
            Hide
            salvetore Michael de Raadt added a comment -

            Test result: The creator and last modifier is set to the user who imports the questions into the Question bank.

            Show
            salvetore Michael de Raadt added a comment - Test result: The creator and last modifier is set to the user who imports the questions into the Question bank.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Closing, this is now part of Moodle. Big thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Closing, this is now part of Moodle. Big thanks!

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Oct/11