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

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

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.7.6, 3.8.3
    • 3.9
    • Questions

    Description

      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.

      Attachments

        Activity

          People

            timhunt Tim Hunt
            timhunt Tim Hunt
            David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
            Adrian Greeve Adrian Greeve
            CiBoT CiBoT
            Safat Shahin, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              15/Jun/20

              Time Tracking

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