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

events_dispatch can block events when plugin removed from codebase but events_handlers record still exists.

XMLWordPrintable

    • MOODLE_23_STABLE
    • 3.3 sprint 4

      If a plugin is installed that has event_handlers for a specific event and the code is removed without using the "uninstall plugin" feature then this can block this type of event from ever being called/loaded by other plugins.

      eg - event role_assigned is handled by enrol_meta plugin.
      if enrol_meta plugin is removed at the code level and not by using the uninstall plugin feature when the role_assigned event is triggered it will be passed to the events_dispatch function which will return a null state with the message "Handler file of component plugin: handlerfile can not be found" - and any other plugin that wants to use the event "role_assigned" will not be called as the handler for enrol_meta will continue reattempting each cron blocking other attempts.

      We should either...
      On the admin screen show massive warnings for plugins that have been deleted but still have event handlers in the db

      or - change the 2 calls to return null in events_dispatch to return true to completely dump the events as they cannot be used so why keep them in the db and keep trying to use them?

      I found this when doing some work on plagiarism plugins (which didn't actually have the ability to use uninstall_plugin until recently) - if someone previously installed a plagiarism plugin but has since deleted one but kept others - all events will be blocked until the incorrect handlers are removed from the db.

      thoughts anyone?

            abgreeve Adrian Greeve
            danmarsden Dan Marsden
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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