Adds trigger when plugins are loaded (#5260)

* added trigger when plugins are loaded

* only trigger if db is ready
This commit is contained in:
Matthias Mair 2023-07-21 00:56:19 +02:00 committed by GitHub
parent 1ab772e66d
commit 2fc82fd0e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ from maintenance_mode.core import (get_maintenance_mode, maintenance_mode_on,
set_maintenance_mode)
from InvenTree.config import get_setting
from InvenTree.ready import canAppAccessDatabase
from .helpers import (IntegrationPluginError, get_entrypoints, get_plugins,
handle_error, log_error)
@ -166,6 +167,11 @@ class PluginsRegistry:
logger.debug('Finished loading plugins')
# Trigger plugins_loaded event
if canAppAccessDatabase():
from plugin.events import trigger_event
trigger_event('plugins_loaded')
def unload_plugins(self, force_reload: bool = False):
"""Unload and deactivate all IntegrationPlugins.