From fcb1c816a1e438767815d0829208d3c0df868743 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 3 Dec 2015 14:47:47 +0000 Subject: storagemanager: Split config retrieval into its own function --- core/storagemanager.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/storagemanager.lua b/core/storagemanager.lua index fb868d03..21f5fd1d 100644 --- a/core/storagemanager.lua +++ b/core/storagemanager.lua @@ -57,8 +57,12 @@ local function load_driver(host, driver_name) return stores_available:get(host, driver_name); end +local function get_storage_config(host) + return config.get(host, "storage"); +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 +98,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 = {}; -- cgit v1.2.3 From cf88b880cd19bd21161f6b3e8688fb752a96f64d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 3 Dec 2015 14:57:49 +0000 Subject: storagemanager, mod_storage_sql, mod_storage_sql2: Rename mod_storage_sql2 -> mod_storage_sql, mod_storage_sql -> mod_storage_sql1 (temporarily), and emit warning for configs using sql2 --- core/storagemanager.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/storagemanager.lua b/core/storagemanager.lua index 21f5fd1d..c312cf05 100644 --- a/core/storagemanager.lua +++ b/core/storagemanager.lua @@ -58,7 +58,23 @@ local function load_driver(host, driver_name) end local function get_storage_config(host) - return config.get(host, "storage"); + -- 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) -- cgit v1.2.3