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

tool_uploadcourse MUC caches enrolment instances

XMLWordPrintable

      As discussed maherne privately, we have discovered that the get_enrolment_plugins method of tool_uploadcourse is caching the result of enrol_get_plugins(false).

      The enrol_get_plugins method returns instances of enrolment plugins.

      We should not really be caching enrolmeny plugin instances. If we need MUC caching for this, it should be in enrol_get_plugins() and not in a consumer.

      We should rip this out as it breaks the ability to use dependency injection in sensible ways in enrolment plugins.

      I'm marking this as a bug because we should not be caching instances of things in the vast majority of cases.

      Looking at the content of enrol_get_plugins, there is very little benefit in actually having caching here anyway. Once the classes are loaded (which they are after the first load) most of the method is not used anyway.

      In future we should be renaming these lib.php classes to autoloaded classes which kills off even more of this method.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Michael Aherne Michael Aherne
            Huong Nguyen Huong Nguyen
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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