core/storagemanager.lua
changeset 13262 c8c0cfb7f5df
parent 12976 ead41e25ebc0
equal deleted inserted replaced
13260:53708752cc5d 13262:c8c0cfb7f5df
    89 	end
    89 	end
    90 	return stores_available:get(host, driver_name);
    90 	return stores_available:get(host, driver_name);
    91 end
    91 end
    92 
    92 
    93 local function get_storage_config(host)
    93 local function get_storage_config(host)
    94 	-- COMPAT w/ unreleased Prosody 0.10 and the once-experimental mod_storage_sql2 in peoples' config files
    94 	-- Here used to be some some compat checks
    95 	local storage_config = config.get(host, "storage");
    95 	return config.get(host, "storage");
    96 	local found_sql2;
       
    97 	if storage_config == "sql2" then
       
    98 		storage_config, found_sql2 = "sql", true;
       
    99 	elseif type(storage_config) == "table" then
       
   100 		for store_name, driver_name in pairs(storage_config) do
       
   101 			if driver_name == "sql2" then
       
   102 				storage_config[store_name] = "sql";
       
   103 				found_sql2 = true;
       
   104 			end
       
   105 		end
       
   106 	end
       
   107 	if found_sql2 then
       
   108 		log("error", "The temporary 'sql2' storage module has now been renamed to 'sql', "
       
   109 			.."please update your config file: https://prosody.im/doc/modules/mod_storage_sql2");
       
   110 	end
       
   111 	return storage_config;
       
   112 end
    96 end
   113 
    97 
   114 local function get_driver(host, store)
    98 local function get_driver(host, store)
   115 	local storage = get_storage_config(host);
    99 	local storage = get_storage_config(host);
   116 	local driver_name;
   100 	local driver_name;