diff options
author | Kim Alvefur <zash@zash.se> | 2023-06-06 22:00:54 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-06-06 22:00:54 +0200 |
commit | 9777b5158f216c9a79d0767c1b5ba081f09f54b8 (patch) | |
tree | 3f329843e369379c28472cb1b1bbbb111d60241e | |
parent | 16381e754de9c633c080784286ff2b141299e136 (diff) | |
download | prosody-9777b5158f216c9a79d0767c1b5ba081f09f54b8.tar.gz prosody-9777b5158f216c9a79d0767c1b5ba081f09f54b8.zip |
mod_admin_shell: Warn when (un-)loading module would be undone by restart
Reminder to update the configuration if the change is to be permanent.
-rw-r--r-- | plugins/mod_admin_shell.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index 8b901031..e62c3920 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -599,6 +599,8 @@ function def_env.module:load(name, hosts) -- Load the module for each host local ok, err, count, mod = true, nil, 0; for host in hosts do + local configured_modules, component = modulemanager.get_modules_for_host(host); + if (not modulemanager.is_loaded(host, name)) then mod, err = modulemanager.load(host, name); if not mod then @@ -613,6 +615,10 @@ function def_env.module:load(name, hosts) else count = count + 1; self.session.print("Loaded for "..mod.module.host); + + if not (configured_modules:contains(name) or name == component) then + self.session.print("Note: Module will not be loaded after restart unless enabled in configuration"); + end end end end @@ -626,6 +632,8 @@ function def_env.module:unload(name, hosts) -- Unload the module for each host local ok, err, count = true, nil, 0; for host in hosts do + local configured_modules, component = modulemanager.get_modules_for_host(host); + if modulemanager.is_loaded(host, name) then ok, err = modulemanager.unload(host, name); if not ok then @@ -634,6 +642,10 @@ function def_env.module:unload(name, hosts) else count = count + 1; self.session.print("Unloaded from "..host); + + if configured_modules:contains(name) or name == component then + self.session.print("Note: Module will be loaded after restart unless disabled in configuration"); + end end end end |