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

    Details

    • Affected Branches:
      MOODLE_23_STABLE
    • Sprint:
      3.3 sprint 4

      Description

      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?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                abgreeve Adrian Greeve
                Reporter:
                danmarsden Dan Marsden
                Participants:
                Component watchers:
                Jake Dallimore, Jun Pataleta, Dan Marsden, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: