Changeset

12927:918dfbb330fd

mod_admin_shell: Limit module dependency listings to loaded on current host E.g. module:info("http") with many http modules loaded would show a lot of duplication, as each module would be listed for each host, even if not actually enabled on that host.
author Kim Alvefur <zash@zash.se>
date Fri, 10 Mar 2023 12:33:02 +0100
parents 12926:f9e474cb86ac
children 12928:916af6fcef1e
files plugins/mod_admin_shell.lua
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua	Fri Mar 10 10:55:50 2023 +0100
+++ b/plugins/mod_admin_shell.lua	Fri Mar 10 12:33:02 2023 +0100
@@ -572,13 +572,20 @@
 		if mod.module.dependencies and next(mod.module.dependencies) ~= nil then
 			print("  dependencies:");
 			for dep in pairs(mod.module.dependencies) do
-				print("  - mod_" .. dep);
+				-- Dependencies are per module instance, not per host, so dependencies
+				-- of/on global modules may list modules not actually loaded on the
+				-- current host.
+				if modulemanager.is_loaded(host, dep) then
+					print("  - mod_" .. dep);
+				end
 			end
 		end
 		if mod.module.reverse_dependencies and next(mod.module.reverse_dependencies) ~= nil then
 			print("  reverse dependencies:");
 			for dep in pairs(mod.module.reverse_dependencies) do
-				print("  - mod_" .. dep);
+				if modulemanager.is_loaded(host, dep) then
+					print("  - mod_" .. dep);
+				end
 			end
 		end
 	end