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

AI: Remove provider instances when provider plugin uninstalled

XMLWordPrintable

    • 2
    • Team Hedgehogs 2025 Sprint 1.3, Team Hedgehogs 2025 Sprint 1.4, Team Hedgehogs 2025 Sprint 2.0

      Current behaviour

      When uninstalling a provider plugin with instances, it does not clean up the data from those instances from the database.

      The following error is displayed because the reference in the ai_providers database table hasn't been removed after uninstalling the plugin:

       

      Unable to find a provider class for aiprovider_dummyai\provider
       
      line 446 of /ai/classes/manager.php: call to debugging() line ? of unknownfile: call to core_ai\manager->core_ai\{closure}()line 441 of /ai/classes/manager.php: call to array_map() line 577 of /ai/classes/manager.php: call to core_ai\manager->get_provider_instances() line 82 of /ai/classes/manager.php: call to core_ai\manager->get_sorted_providers() line 347 of /ai/classes/manager.php: call to core_ai\manager->get_providers_for_actions() line 52 of /ai/placement/editor/classes/utils.php: call to core_ai\manager->is_action_available() line 95 of /lib/editor/tiny/plugins/aiplacement/classes/plugininfo.php: call to aiplacement_editor\utils::is_html_editor_placement_action_available() line 53 of /lib/editor/tiny/plugins/aiplacement/classes/plugininfo.php: call to tiny_aiplacement\plugininfo::get_allowed_actions() line 66 of /lib/editor/tiny/classes/manager.php: call to tiny_aiplacement\plugininfo::is_enabled() line 58 of /lib/editor/tiny/classes/editor.php: call to editor_tiny\manager->get_plugin_configuration() line 149 of /lib/editor/tiny/classes/editor.php: call to editor_tiny\editor::set_default_configuration() line 433 of /lib/form/editor.php: call to editor_tiny\editor->use_editor() line 500 of /lib/form/editor.php: call to MoodleQuickForm_editor->toHtml() line 4716 of /lib/classes/output/core_renderer.php: call to MoodleQuickForm_editor->export_for_template() line 3444 of /lib/formslib.php: call to core\output\core_renderer->mform_element() line 432 of /lib/pear/HTML/QuickForm/element.php: call to MoodleQuickForm_Renderer->renderElement() line 1644 of /lib/pear/HTML/QuickForm.php: call to HTML_QuickForm_element->accept() line 2130 of /lib/formslib.php: call to HTML_QuickForm->accept() line 1687 of /lib/pear/HTML/QuickForm.php: call to MoodleQuickForm->accept() line 445 of /lib/pear/HTML/Common.php: call to HTML_QuickForm->toHtml() line 1048 of /lib/formslib.php: call to HTML_Common->display() line 366 of /user/editadvanced.php: call to moodleform->display() 

      I haven't tested it in 4.5 (so it might happen the same).

      As part of the work on this issue we need to make sure in addition to the configured provider instances being removed we also make sure that there are no unmet dependencies with the database records about provider and action usage. These should not be an issue, but need to check to confirm.

      Expected behaviour

      No error is displayed.

       

      Setup

      1. Install the ai_provider dummyai: https://github.com/moodlemobile/moodle-aiprovider_dummyai 
      2. Enable Debug messages in Site administration > Development > Debugging.

      Steps to reproduce it

      1. Log in as admin.
      2. Go to Site administration > General > AI providers.
      3. Create a a new provider using the dummyai provider.
      4. Uninstall the dummyai provider.
      5. Go to Site administration > General > AI providers or to any page where the editor is displayed (for instance, Edit user profile page)

            david.woloszyn@moodle.com David Woloszyn
            sarjona Sara Arjona (@sarjona)
            Raquel Ortega Raquel Ortega
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 4 hours, 44 minutes
                1d 4h 44m

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