aboutsummaryrefslogtreecommitdiffstats
path: root/core/storagemanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-12-03 14:59:55 +0000
committerMatthew Wild <mwild1@gmail.com>2015-12-03 14:59:55 +0000
commit2b9a7ef7b48519a64f64268f4b4169c601175e93 (patch)
tree0a45f803690602626615b39fd3c0b17e3df266e7 /core/storagemanager.lua
parentab8006e6152db2531cfc65fbfa4de95efa570d6d (diff)
parentd3b6588fd79e85777cf5c6af4fd870c297dc7daf (diff)
downloadprosody-2b9a7ef7b48519a64f64268f4b4169c601175e93.tar.gz
prosody-2b9a7ef7b48519a64f64268f4b4169c601175e93.zip
Merge 0.10->trunk
Diffstat (limited to 'core/storagemanager.lua')
-rw-r--r--core/storagemanager.lua24
1 files changed, 22 insertions, 2 deletions
diff --git a/core/storagemanager.lua b/core/storagemanager.lua
index 046f496a..33fd5d49 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
@@ -130,7 +150,7 @@ 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 = {};