diff mod_server_status/mod_server_status.lua @ 601:00590d492a5b

mod_server_status: de-revert to use configmanager instead of module mm for the cleanup function also give it an unique name (mismatch possible "??")
author Marco Cirillo <maranda@lightwitch.org>
date Thu, 09 Feb 2012 00:53:32 +0000
parents fe85e18a06cb
children edb4afb6a227
line wrap: on
line diff
--- a/mod_server_status/mod_server_status.lua	Thu Feb 09 00:52:18 2012 +0000
+++ b/mod_server_status/mod_server_status.lua	Thu Feb 09 00:53:32 2012 +0000
@@ -130,7 +130,7 @@
 -- initialization.
 -- init http interface
 
-function cleanup() -- handy, recycled from mod_register_json
+function stats_cleanup() -- handy, recycled from mod_register_json
         module:log("debug", "Cleaning up handlers and stuff as module is being unloaded.")
         for _, options in ipairs(ports) do
                 if options.port then
@@ -138,7 +138,7 @@
                 end
         end
 
-	local event = module:get_option_boolen("use_libevent", false)
+	local event = require "core.configmanager".get("*", "core", "use_libevent")
 
 	-- if there're no handlers left clean the socket, not sure if it works with server_select
 	if not event then
@@ -154,12 +154,12 @@
 	        end
 	end
 
-        prosody.events.remove_handler("module-unloaded", cleanup)
+        prosody.events.remove_handler("module-unloaded", stats_cleanup)
 end
 
 local function setup()
 	httpserver.new_from_config(ports, request, { base = "server-status" })
-	prosody.events.add_handler("module-unloaded", cleanup)
+	prosody.events.add_handler("module-unloaded", stats_cleanup)
 end
 
 if prosody.start_time then