mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Adds trigger when plugins are loaded (#5260)
* added trigger when plugins are loaded * only trigger if db is ready
This commit is contained in:
parent
1ab772e66d
commit
2fc82fd0e3
@ -25,6 +25,7 @@ from maintenance_mode.core import (get_maintenance_mode, maintenance_mode_on,
|
|||||||
set_maintenance_mode)
|
set_maintenance_mode)
|
||||||
|
|
||||||
from InvenTree.config import get_setting
|
from InvenTree.config import get_setting
|
||||||
|
from InvenTree.ready import canAppAccessDatabase
|
||||||
|
|
||||||
from .helpers import (IntegrationPluginError, get_entrypoints, get_plugins,
|
from .helpers import (IntegrationPluginError, get_entrypoints, get_plugins,
|
||||||
handle_error, log_error)
|
handle_error, log_error)
|
||||||
@ -166,6 +167,11 @@ class PluginsRegistry:
|
|||||||
|
|
||||||
logger.debug('Finished loading plugins')
|
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):
|
def unload_plugins(self, force_reload: bool = False):
|
||||||
"""Unload and deactivate all IntegrationPlugins.
|
"""Unload and deactivate all IntegrationPlugins.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user