X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=core%2Fstoragemanager.lua;h=c312cf057bcd8bc3390f2193d13d85f7a1fe157c;hb=77f0e4bb8177dd3a197250888045d033ed43451f;hp=fb868d03e574db9d92ad23b062e7a06ceb0296ea;hpb=0979336ed04a158da127710b0cf574c885556668;p=prosody.git diff --git a/core/storagemanager.lua b/core/storagemanager.lua index fb868d03..c312cf05 100644 --- a/core/storagemanager.lua +++ b/core/storagemanager.lua @@ -57,8 +57,28 @@ local function load_driver(host, driver_name) return stores_available:get(host, driver_name); end +local function get_storage_config(host) + -- COMPAT w/ unreleased Prosody 0.10 and the once-experimental mod_storage_sql2 in peoples' config files + local storage_config = config.get(host, "storage"); + local found_sql2; + if storage_config == "sql2" then + storage_config, found_sql2 = "sql", true; + elseif type(storage_config) == "table" then + for store_name, driver_name in pairs(storage_config) do + if driver_name == "sql2" then + storage_config[store_name] = "sql"; + found_sql2 = true; + end + end + end + if found_sql2 then + 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"); + end + return storage_config; +end + local function get_driver(host, store) - local storage = config.get(host, "storage"); + local storage = get_storage_config(host); local driver_name; local option_type = type(storage); if option_type == "string" then @@ -94,7 +114,7 @@ local function open(host, store, typ) end local function purge(user, host) - local storage = config.get(host, "storage"); + local storage = get_storage_config(host); if type(storage) == "table" then -- multiple storage backends in use that we need to purge local purged = {};