aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-03-05 14:07:08 +0100
committerKim Alvefur <zash@zash.se>2023-03-05 14:07:08 +0100
commit32445b308284f8475587aa12dd4778c3234aa31a (patch)
treec06e034a7c59b146f19135b39a929fcf515e315f /core
parent4d46c278406e72d934823117eddfa2e7a35c8cc1 (diff)
downloadprosody-32445b308284f8475587aa12dd4778c3234aa31a.tar.gz
prosody-32445b308284f8475587aa12dd4778c3234aa31a.zip
core.moduleapi: Record reverse dependencies
Useful to know why a module was auto-loaded without having to dig trough all other modules for the one that depends on it.
Diffstat (limited to 'core')
-rw-r--r--core/moduleapi.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 5f9ee3c7..4afadfd7 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -169,6 +169,10 @@ function api:depends(name)
end
end
self.dependencies[name] = true;
+ if not mod.module.reverse_dependencies then
+ mod.module.reverse_dependencies = {};
+ end
+ mod.module.reverse_dependencies[self.name] = true;
return mod;
end