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

Question bank should not do output in backend functions when contexts are deleted

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.9
    • 3.7.6, 3.8.3
    • Questions

      At the moment, when you delete a course, activity, or course category, you get a bunch of output saying "This category has been deleted because, after deleting the course, its questions weren't used any more." This is not a very helpful message. If a think was deleted, of course all the associated data deleted with it will be deleted too.

      In fact, the more interesting case is that sometimes, things won't be deleted becuase something else was using them (due to MDL-14802). However, there is no output to tell you this.

      Practically, this causes problems for third-party plugins. For example, at the moment, installing StudentQuiz causes some core unit tests to fail: https://github.com/frankkoch/moodle-mod_studentquiz/issues/227

      And, generally it goes against basic principles of Moodle design for a back-end function like question_delete_activity to do output. This has caused problems in the past: MDL-64531. It also requires a number of unit tests to contain $this->expectOutputRegex('/'.get_string('unusedcategorydeleted', 'question').'/'); when than is pretty irrelevant to what is being tested.

            timhunt Tim Hunt
            timhunt Tim Hunt
            David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
            Adrian Greeve Adrian Greeve
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            3 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, 31 minutes
                1h 31m

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