mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-12 19:36:39 +00:00
have the plugin manager remove the scripts and directories from the server when a plugin is disabled
This commit is contained in:
parent
92ecb3fe87
commit
b2390b8ff4
@ -86,7 +86,24 @@ class PluginManager(PluginManagerBase, component.Component):
|
|||||||
log.info("Plugin has no web ui")
|
log.info("Plugin has no web ui")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
info = gather_info(plugin)
|
||||||
|
|
||||||
server = component.get("DelugeWeb").top_level
|
server = component.get("DelugeWeb").top_level
|
||||||
|
js = component.get("Javascript")
|
||||||
|
for directory in info["script_directories"]:
|
||||||
|
js.removeDirectory(directory, name.lower())
|
||||||
|
|
||||||
|
for script in info["scripts"]:
|
||||||
|
script = "/js/%s/%s" % (name.lower(), os.path.basename(script))
|
||||||
|
if script not in server.scripts:
|
||||||
|
continue
|
||||||
|
server.scripts.remove(script)
|
||||||
|
|
||||||
|
for script in info["debug_scripts"]:
|
||||||
|
script = "/js/%s/%s" % (name.lower(), os.path.basename(script))
|
||||||
|
if script not in server.debug_scripts:
|
||||||
|
continue
|
||||||
|
server.debug_scripts.remove(script)
|
||||||
|
|
||||||
super(PluginManager, self).disable_plugin(name)
|
super(PluginManager, self).disable_plugin(name)
|
||||||
|
|
||||||
|
@ -256,6 +256,10 @@ class LookupResource(resource.Resource, component.Component):
|
|||||||
paths.append(directory)
|
paths.append(directory)
|
||||||
self.__paths[path] = paths
|
self.__paths[path] = paths
|
||||||
|
|
||||||
|
def removeDirectory(self, directory, path=""):
|
||||||
|
log.debug("Removing directory `%s`", directory)
|
||||||
|
self.__paths[path].remove(directory)
|
||||||
|
|
||||||
def getChild(self, path, request):
|
def getChild(self, path, request):
|
||||||
if hasattr(request, 'lookup_path'):
|
if hasattr(request, 'lookup_path'):
|
||||||
request.lookup_path += '/' + path
|
request.lookup_path += '/' + path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user