Software /
code /
prosody
Comparison
plugins/mod_admin_telnet.lua @ 4645:4539e99be743
mod_admin_telnet: module:reload(): If module is loaded on *, reload it there first (ensuring shared module code is reloaded before per-host children of that module)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 21 Apr 2012 20:39:21 +0100 |
parent | 4644:fb067c8a8d2e |
child | 4646:e0bd8587f2fb |
comparison
equal
deleted
inserted
replaced
4644:fb067c8a8d2e | 4645:4539e99be743 |
---|---|
332 end | 332 end |
333 | 333 |
334 function def_env.module:reload(name, hosts) | 334 function def_env.module:reload(name, hosts) |
335 local mm = require "modulemanager"; | 335 local mm = require "modulemanager"; |
336 | 336 |
337 hosts = get_hosts_set(hosts, name); | 337 hosts = array.collect(get_hosts_set(hosts, name)):sort(function (a, b) |
338 | 338 if a == "*" then return true |
339 elseif b == "*" then return false | |
340 else return a < b; end | |
341 end); | |
342 | |
339 -- Reload the module for each host | 343 -- Reload the module for each host |
340 local ok, err, count = true, nil, 0; | 344 local ok, err, count = true, nil, 0; |
341 for host in hosts do | 345 for _, host in ipairs(hosts) do |
342 if mm.is_loaded(host, name) then | 346 if mm.is_loaded(host, name) then |
343 ok, err = mm.reload(host, name); | 347 ok, err = mm.reload(host, name); |
344 if not ok then | 348 if not ok then |
345 ok = false; | 349 ok = false; |
346 self.session.print(err or "Unknown error reloading module"); | 350 self.session.print(err or "Unknown error reloading module"); |