157 function def_env.server:reload() |
157 function def_env.server:reload() |
158 prosody.unlock_globals(); |
158 prosody.unlock_globals(); |
159 dofile "prosody" |
159 dofile "prosody" |
160 prosody = _G.prosody; |
160 prosody = _G.prosody; |
161 return true, "Server reloaded"; |
161 return true, "Server reloaded"; |
|
162 end |
|
163 |
|
164 function def_env.server:version() |
|
165 return true, tostring(prosody.version or "unknown"); |
|
166 end |
|
167 |
|
168 function def_env.server:uptime() |
|
169 local t = os.time()-prosody.start_time; |
|
170 local seconds = t%60; |
|
171 t = (t - seconds)/60; |
|
172 local minutes = t%60; |
|
173 t = (t - minutes)/60; |
|
174 local hours = t%24; |
|
175 t = (t - hours)/24; |
|
176 local days = t; |
|
177 return true, string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)", |
|
178 days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "", |
|
179 minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time)); |
162 end |
180 end |
163 |
181 |
164 def_env.module = {}; |
182 def_env.module = {}; |
165 |
183 |
166 local function get_hosts_set(hosts, module) |
184 local function get_hosts_set(hosts, module) |