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

Stop loading subplugins.json unnecessarily

XMLWordPrintable

      Whilst working on MDL-83703 I discovered that every time we call \core\context\module::get_capabilities() we scan the file system and look for and load subplugins.json files.

      From what I can tell, this change was introduced in MDL-29602 in 2011 before the component::get_subplugins() method was created via MDL-42078 in 2013.

      Looking into this code, I don't believe that we should be loading from disk every time. The code only works for installed plugins, it isn't loading any new capabilities from disk anyway, so there is no benefit to it.

      We also do the same thing in lib/adminlib.php in the uninstall_plugin() method. In this case we are fetching the subplugin types from the disk, but defer to the \core\component cache to actually query the plugins, which renders the subplugin fetch moot.

      In both of these cases we can simply switch to using \core\component::get_subplugins($component);

        1. Screenshot 2024-11-15 at 1.41.54 PM.png
          83 kB
          Stevani Andolo
        2. MDL-83704.png
          408 kB
          Ron Carl Alfon Yu

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Stevani Andolo Stevani Andolo
            Safat Shahin Safat Shahin
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            6 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, 56 minutes
                1h 56m

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