Comparison

plugins/mod_admin_shell.lua @ 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
parent 12922:aaf055d6fe7a
child 12977:74b9e05af71e
comparison
equal deleted inserted replaced
12926:f9e474cb86ac 12927:918dfbb330fd
570 end 570 end
571 end 571 end
572 if mod.module.dependencies and next(mod.module.dependencies) ~= nil then 572 if mod.module.dependencies and next(mod.module.dependencies) ~= nil then
573 print(" dependencies:"); 573 print(" dependencies:");
574 for dep in pairs(mod.module.dependencies) do 574 for dep in pairs(mod.module.dependencies) do
575 print(" - mod_" .. dep); 575 -- Dependencies are per module instance, not per host, so dependencies
576 -- of/on global modules may list modules not actually loaded on the
577 -- current host.
578 if modulemanager.is_loaded(host, dep) then
579 print(" - mod_" .. dep);
580 end
576 end 581 end
577 end 582 end
578 if mod.module.reverse_dependencies and next(mod.module.reverse_dependencies) ~= nil then 583 if mod.module.reverse_dependencies and next(mod.module.reverse_dependencies) ~= nil then
579 print(" reverse dependencies:"); 584 print(" reverse dependencies:");
580 for dep in pairs(mod.module.reverse_dependencies) do 585 for dep in pairs(mod.module.reverse_dependencies) do
581 print(" - mod_" .. dep); 586 if modulemanager.is_loaded(host, dep) then
587 print(" - mod_" .. dep);
588 end
582 end 589 end
583 end 590 end
584 end 591 end
585 return true; 592 return true;
586 end 593 end