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

Improve code access to the available updates via plugin manager



      This was suggested by skodak while we were talking about MDL-48210. Currently, every time we call plugin manager's get_plugins(), it automatically loads available updates to the tree of plugins (unless this feature is disabled). But we do not need that information for most of the time, only at dedicated admin pages.

      The plan is to move the following part

              if (empty($CFG->disableupdatenotifications) and !during_initial_install()) {
                  // Append the information about available updates provided by {@link \core\update\checker()}.
                  $provider = \core\update\checker::instance();
                  foreach ($plugins as $plugininfoholder) {

      from the method core_plugin_manager::get_plugins_of_type() into the method \core\plugininfo\base::available_updates() that would call $this->check_available_updates() only if the property $this->availableupdates is not set yet, setting it to either array of \core\update\info objects, or false. The property will become protected (the current code relying on it would be changed to use methods). We may want new \core\plugininfo\base::has_available_updates() too.

      The suggested change seems to make the code more reliable. It is supposed to save some processing and at least one DB query by loading available updates info only when needed.

            Unassigned Unassigned
            mudrd8mz David Mudrák (@mudrd8mz)
            1 Vote for this issue
            4 Start watching this issue


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