mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +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
2 changed files with 21 additions and 0 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -255,6 +255,10 @@ class LookupResource(resource.Resource, component.Component):
|
||||||
paths = self.__paths.get(path, [])
|
paths = self.__paths.get(path, [])
|
||||||
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'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue