aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan Epstein <aidan@jmad.org>2024-09-29 18:09:17 -0700
committerAidan Epstein <aidan@jmad.org>2024-09-29 18:09:17 -0700
commitf964cc51bba298633c58d2ae640a7ddd1feb9eed (patch)
tree93b393394e423afef3c6de69a43cd214e0235aa7
parenta719f5897c2a488add6dcd63edc47e32de7e6c73 (diff)
downloadprosody-f964cc51bba298633c58d2ae640a7ddd1feb9eed.tar.gz
prosody-f964cc51bba298633c58d2ae640a7ddd1feb9eed.zip
mod_admin_adhoc: Fix log messages for reloading modules.origin/0.120.12
Also rename for loop item so that it doesn't shadow module variable.
-rw-r--r--plugins/mod_admin_adhoc.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/mod_admin_adhoc.lua b/plugins/mod_admin_adhoc.lua
index d0b0d452..5a565fb3 100644
--- a/plugins/mod_admin_adhoc.lua
+++ b/plugins/mod_admin_adhoc.lua
@@ -530,15 +530,15 @@ end, function(fields, err, data)
return generate_error_message(err);
end
local ok_list, err_list = {}, {};
- for _, module in ipairs(fields.modules) do
- local ok, err = modulemanager.reload(module_host, module);
+ for _, module_ in ipairs(fields.modules) do
+ local ok, err = modulemanager.reload(module_host, module_);
if ok then
- ok_list[#ok_list + 1] = module;
+ ok_list[#ok_list + 1] = module_;
else
- err_list[#err_list + 1] = module .. "(Error: " .. tostring(err) .. ")";
+ err_list[#err_list + 1] = module_ .. "(Error: " .. tostring(err) .. ")";
end
+ module:log("info", "mod_%s reloaded by %s", module_, jid.bare(data.from));
end
- module:log("info", "mod_%s reloaded by %s", fields.module, jid.bare(data.from));
local info = (#ok_list > 0 and ("The following modules were successfully reloaded on host "..module_host..":\n"..t_concat(ok_list, "\n")) or "")
.. ((#ok_list > 0 and #err_list > 0) and "\n" or "") ..
(#err_list > 0 and ("Failed to reload the following modules on host "..module_host..":\n"..t_concat(err_list, "\n")) or "");
@@ -680,15 +680,15 @@ end, function(fields, err, data)
return generate_error_message(err);
end
local ok_list, err_list = {}, {};
- for _, module in ipairs(fields.modules) do
- local ok, err = modulemanager.unload(module_host, module);
+ for _, module_ in ipairs(fields.modules) do
+ local ok, err = modulemanager.unload(module_host, module_);
if ok then
- ok_list[#ok_list + 1] = module;
+ ok_list[#ok_list + 1] = module_;
else
- err_list[#err_list + 1] = module .. "(Error: " .. tostring(err) .. ")";
+ err_list[#err_list + 1] = module_ .. "(Error: " .. tostring(err) .. ")";
end
+ module:log("info", "mod_%s unloaded by %s", module_, jid.bare(data.from));
end
- module:log("info", "mod_%s unloaded by %s", fields.module, jid.bare(data.from));
local info = (#ok_list > 0 and ("The following modules were successfully unloaded on host "..module_host..":\n"..t_concat(ok_list, "\n")) or "")
.. ((#ok_list > 0 and #err_list > 0) and "\n" or "") ..
(#err_list > 0 and ("Failed to unload the following modules on host "..module_host..":\n"..t_concat(err_list, "\n")) or "");