X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=prosody;h=b8de92f59c4f235d0dc8e64b8d3c45b345a9cada;hb=d6babde5a292f79e524da01a0a575688bc99cbda;hp=64021fd32f2548ce4ac65417229e957cebcf7109;hpb=3b635da220bdbe28712f7007be430eb6e1283912;p=prosody.git diff --git a/prosody b/prosody index 64021fd3..b8de92f5 100755 --- a/prosody +++ b/prosody @@ -128,7 +128,7 @@ function log_dependency_warnings() end function sanity_check() - for host, host_config in pairs(configmanager.getconfig()) do + for host, host_config in pairs(config.getconfig()) do if host ~= "*" and host_config.core.enabled ~= false and not host_config.core.component_module then @@ -145,9 +145,13 @@ function sandbox_require() -- for neat sandboxing of modules local _realG = _G; local _real_require = require; + if not getfenv then + -- FIXME: This is a hack to replace getfenv() in Lua 5.2 + function getfenv(f) return debug.getupvalue(debug.getinfo(f or 1).func, 1); end + end function require(...) local curr_env = getfenv(2); - local curr_env_mt = getmetatable(getfenv(2)); + local curr_env_mt = getmetatable(curr_env); local _realG_mt = getmetatable(_realG); if curr_env_mt and curr_env_mt.__index and not curr_env_mt.__newindex and _realG_mt then local old_newindex, old_index; @@ -279,12 +283,12 @@ function load_secondary_libraries() require "util.import" require "util.xmppstream" require "core.rostermanager" + require "core.stanza_router" require "core.hostmanager" require "core.portmanager" require "core.modulemanager" require "core.usermanager" require "core.sessionmanager" - require "core.stanza_router" package.loaded['core.componentmanager'] = setmetatable({},{__index=function() log("warn", "componentmanager is deprecated: %s", debug.traceback():match("\n[^\n]*\n[ \t]*([^\n]*)")); return function() end