comparison plugins/mod_admin_adhoc.lua @ 13529:3ec7222349ac

Merge 0.12->trunk
author Kim Alvefur <zash@zash.se>
date Sat, 26 Oct 2024 12:43:53 +0200
parents 74b9e05af71e c228f1ffb7b3
children
comparison
equal deleted inserted replaced
13527:dba43269db5e 13529:3ec7222349ac
590 end, function(fields, err, data) 590 end, function(fields, err, data)
591 if err then 591 if err then
592 return generate_error_message(err); 592 return generate_error_message(err);
593 end 593 end
594 local ok_list, err_list = {}, {}; 594 local ok_list, err_list = {}, {};
595 for _, module in ipairs(fields.modules) do 595 for _, module_ in ipairs(fields.modules) do
596 local ok, err = modulemanager.reload(module_host, module); 596 local ok, err = modulemanager.reload(module_host, module_);
597 if ok then 597 if ok then
598 ok_list[#ok_list + 1] = module; 598 ok_list[#ok_list + 1] = module_;
599 else 599 else
600 err_list[#err_list + 1] = module .. "(Error: " .. tostring(err) .. ")"; 600 err_list[#err_list + 1] = module_ .. "(Error: " .. tostring(err) .. ")";
601 end 601 end
602 end 602 module:log("info", "mod_%s reloaded by %s", module_, jid.bare(data.from));
603 module:log("info", "mod_%s reloaded by %s", fields.module, jid.bare(data.from)); 603 end
604 local info = (#ok_list > 0 and ("The following modules were successfully reloaded on host "..module_host..":\n"..t_concat(ok_list, "\n")) or "") 604 local info = (#ok_list > 0 and ("The following modules were successfully reloaded on host "..module_host..":\n"..t_concat(ok_list, "\n")) or "")
605 .. ((#ok_list > 0 and #err_list > 0) and "\n" or "") .. 605 .. ((#ok_list > 0 and #err_list > 0) and "\n" or "") ..
606 (#err_list > 0 and ("Failed to reload the following modules on host "..module_host..":\n"..t_concat(err_list, "\n")) or ""); 606 (#err_list > 0 and ("Failed to reload the following modules on host "..module_host..":\n"..t_concat(err_list, "\n")) or "");
607 return { status = "completed", info = info }; 607 return { status = "completed", info = info };
608 end); 608 end);
740 end, function(fields, err, data) 740 end, function(fields, err, data)
741 if err then 741 if err then
742 return generate_error_message(err); 742 return generate_error_message(err);
743 end 743 end
744 local ok_list, err_list = {}, {}; 744 local ok_list, err_list = {}, {};
745 for _, module in ipairs(fields.modules) do 745 for _, module_ in ipairs(fields.modules) do
746 local ok, err = modulemanager.unload(module_host, module); 746 local ok, err = modulemanager.unload(module_host, module_);
747 if ok then 747 if ok then
748 ok_list[#ok_list + 1] = module; 748 ok_list[#ok_list + 1] = module_;
749 else 749 else
750 err_list[#err_list + 1] = module .. "(Error: " .. tostring(err) .. ")"; 750 err_list[#err_list + 1] = module_ .. "(Error: " .. tostring(err) .. ")";
751 end 751 end
752 end 752 module:log("info", "mod_%s unloaded by %s", module_, jid.bare(data.from));
753 module:log("info", "mod_%s unloaded by %s", fields.module, jid.bare(data.from)); 753 end
754 local info = (#ok_list > 0 and ("The following modules were successfully unloaded on host "..module_host..":\n"..t_concat(ok_list, "\n")) or "") 754 local info = (#ok_list > 0 and ("The following modules were successfully unloaded on host "..module_host..":\n"..t_concat(ok_list, "\n")) or "")
755 .. ((#ok_list > 0 and #err_list > 0) and "\n" or "") .. 755 .. ((#ok_list > 0 and #err_list > 0) and "\n" or "") ..
756 (#err_list > 0 and ("Failed to unload the following modules on host "..module_host..":\n"..t_concat(err_list, "\n")) or ""); 756 (#err_list > 0 and ("Failed to unload the following modules on host "..module_host..":\n"..t_concat(err_list, "\n")) or "");
757 return { status = "completed", info = info }; 757 return { status = "completed", info = info };
758 end); 758 end);