kopia lustrzana https://github.com/OpenDroneMap/WebODM
Added virtual functions for enable()/disable() lifecycle management
rodzic
78da2a619f
commit
fec9437f2d
|
@ -57,6 +57,27 @@ class PluginBase(ABC):
|
|||
else:
|
||||
logger.warning("Failed to install requirements.txt for {}".format(self))
|
||||
|
||||
def enable(self):
|
||||
"""
|
||||
Should be overriden by plugins to perform persistent setup and configuration
|
||||
(e.g., registering static files, initializing databse entries, or hooking
|
||||
into WebODM’s functionality). Called once, each time a plugin is enabled. If
|
||||
this method throws an exception, it will not be enabled by the system.
|
||||
:return: none
|
||||
"""
|
||||
pass
|
||||
|
||||
def disable(self):
|
||||
"""
|
||||
Should be overriden by plugins to perform cleanup or other persistent tasks
|
||||
to restore the system to pre-enabled state (e.g., removing hooks, deleting
|
||||
temporary data, or restoring system state). Called once each time a plugin
|
||||
is disabled. If this method fails to complete or throws an exception, it will
|
||||
still be disabled by the system.
|
||||
:return: none
|
||||
"""
|
||||
pass
|
||||
|
||||
def get_persistent_path(self, *paths):
|
||||
return get_plugins_persistent_path(self.name, *paths)
|
||||
|
||||
|
@ -247,4 +268,4 @@ class PluginBase(ABC):
|
|||
return self.manifest
|
||||
|
||||
def __str__(self):
|
||||
return "[{}]".format(self.get_module_name())
|
||||
return "[{}]".format(self.get_module_name())
|
||||
|
|
Ładowanie…
Reference in New Issue