Software /
code /
prosody-modules
Changeset
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 |
parents | 3583:a36412d4fafd |
children | 3585:ddf109d58eff |
files | mod_migrate/mod_migrate.lua |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
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,