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

Backport to 3.4.x? MDL-63260 Duplicating quiz with random question has exponential questions growth

XMLWordPrintable

    • MOODLE_34_STABLE
    • MOODLE_34_STABLE
    • Hide

      Copied from MDL-63260.

      1. Log in as a teacher in a course.
      2. Create a course
      3. Turn editing on.
      4. Create a quiz
      5. Edit the quiz and add a new True/false question under the course's default question category.
      6. Add a "random question" to the quiz using the course's default question category
      7. Go back to the course page
      8. Duplicate the quiz
      9. Duplicate the quiz again
      10. Duplicate the quiz yet again
      11. Check the question table on the database. (It's most likely mdl_question). You should see 9 questions on the table.
      12. Open a terminal, go to your Moodle instance's root directory and run

        php admin/tool/task/cli/schedule_task.php --execute=\\qtype_random\\task\\remove_unused_questions
        

      13. Confirm that you see a message that 4 unused random questions have been cleaned up.
      14. Check the question table.
      15. Confirm that only 5 questions now remain.
      Show
      Copied from MDL-63260 . Log in as a teacher in a course. Create a course Turn editing on. Create a quiz Edit the quiz and add a new True/false question under the course's default question category. Add a "random question" to the quiz using the course's default question category Go back to the course page Duplicate the quiz Duplicate the quiz again Duplicate the quiz yet again Check the question table on the database. (It's most likely mdl_question). You should see 9 questions on the table. Open a terminal, go to your Moodle instance's root directory and run php admin/tool/task/cli/schedule_task.php --execute=\\qtype_random\\task\\remove_unused_questions Confirm that you see a message that 4 unused random questions have been cleaned up. Check the question table. Confirm that only 5 questions now remain.

      MDL-45851 was a nasty regression that I caused (sorry). That went in to 3.4.5, but the fix MDL-63260 only got into in 3.5.x and later.

      Given the ability of the regression to break people's Moodle sites (see, for example, https://moodle.org/mod/forum/discuss.php?d=382167), I think we should consider back-porting this fix. This is not a security issue (3.4.x is security-only support) but if there was a bug that let a hacker break a user's site, we would patch it. Well, this is a bug where a Moodle developer's actions can break people's Moodle sites.

      (Note, I have not tested the new code in 3.4, but basically it is a new scheduled task so it should be fine. The test script from before can be reused.)

      Thanks for considering this.

            timhunt Tim Hunt
            timhunt Tim Hunt
            Jun Pataleta Jun Pataleta
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 30 minutes
                1h 30m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.