Software /
code /
prosody
Comparison
core/storagemanager.lua @ 6952:db085e55555f
Merge 0.10->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 03 Dec 2015 14:59:55 +0000 |
parent | 6811:82350a06df6e |
parent | 6951:99de8f30d99e |
child | 7157:0890a428a99b |
comparison
equal
deleted
inserted
replaced
6947:032313f356c9 | 6952:db085e55555f |
---|---|
55 log("error", "Failed to load storage driver plugin %s on %s: %s", driver_name, host, err); | 55 log("error", "Failed to load storage driver plugin %s on %s: %s", driver_name, host, err); |
56 end | 56 end |
57 return stores_available:get(host, driver_name); | 57 return stores_available:get(host, driver_name); |
58 end | 58 end |
59 | 59 |
60 local function get_storage_config(host) | |
61 -- COMPAT w/ unreleased Prosody 0.10 and the once-experimental mod_storage_sql2 in peoples' config files | |
62 local storage_config = config.get(host, "storage"); | |
63 local found_sql2; | |
64 if storage_config == "sql2" then | |
65 storage_config, found_sql2 = "sql", true; | |
66 elseif type(storage_config) == "table" then | |
67 for store_name, driver_name in pairs(storage_config) do | |
68 if driver_name == "sql2" then | |
69 storage_config[store_name] = "sql"; | |
70 found_sql2 = true; | |
71 end | |
72 end | |
73 end | |
74 if found_sql2 then | |
75 log("error", "The temporary 'sql2' storage module has now been renamed to 'sql', please update your config file: https://prosody.im/doc/modules/mod_storage_sql2"); | |
76 end | |
77 return storage_config; | |
78 end | |
79 | |
60 local function get_driver(host, store) | 80 local function get_driver(host, store) |
61 local storage = config.get(host, "storage"); | 81 local storage = get_storage_config(host); |
62 local driver_name; | 82 local driver_name; |
63 local option_type = type(storage); | 83 local option_type = type(storage); |
64 if option_type == "string" then | 84 if option_type == "string" then |
65 driver_name = storage; | 85 driver_name = storage; |
66 elseif option_type == "table" then | 86 elseif option_type == "table" then |
128 end | 148 end |
129 return ret, err; | 149 return ret, err; |
130 end | 150 end |
131 | 151 |
132 local function purge(user, host) | 152 local function purge(user, host) |
133 local storage = config.get(host, "storage"); | 153 local storage = get_storage_config(host); |
134 if type(storage) == "table" then | 154 if type(storage) == "table" then |
135 -- multiple storage backends in use that we need to purge | 155 -- multiple storage backends in use that we need to purge |
136 local purged = {}; | 156 local purged = {}; |
137 for store, driver_name in pairs(storage) do | 157 for store, driver_name in pairs(storage) do |
138 if not purged[driver_name] then | 158 if not purged[driver_name] then |