mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-08 01:24:03 +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")
|
||||
return
|
||||
|
||||
info = gather_info(plugin)
|
||||
|
||||
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)
|
||||
|
||||
|
@ -255,6 +255,10 @@ class LookupResource(resource.Resource, component.Component):
|
||||
paths = self.__paths.get(path, [])
|
||||
paths.append(directory)
|
||||
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):
|
||||
if hasattr(request, 'lookup_path'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user