Software /
code /
prosody-modules
Diff
mod_migrate/mod_migrate.lua @ 3584:611ac62c5b63
mod_migrate: Try to use per storage user listing where available
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 05 May 2019 16:04:20 +0200 |
parent | 2816:cd9831b27746 |
child | 4302:c9e1eee6a948 |
line wrap: on
line diff
--- a/mod_migrate/mod_migrate.lua Sun May 05 14:47:07 2019 +0200 +++ b/mod_migrate/mod_migrate.lua Sun May 05 16:04:20 2019 +0200 @@ -1,8 +1,17 @@ -- mod_migrate +local unpack = table.unpack or unpack; local sm = require"core.storagemanager"; local um = require"core.usermanager"; +local function users(store, host) + if store.users then + return store:users(); + else + return um.users(host); + end +end + function module.command(arg) local host, source_stores, migrate_to = unpack(arg); if not migrate_to then @@ -62,7 +71,7 @@ end else xpcall(function() - for user in um.users(host) do + for user in users(storage, host) do migrate_user(user); end end,