# HG changeset patch # User Matthew Wild # Date 1298960043 0 # Node ID bffce780999de86d075a43582a11d6d54cae68e6 # Parent c56a29d4346de928a479951f7f2f14141f3d9083# Parent 8a271b3fcaa7d5e84352bfc43165fb7c5d27c889 Merge 0.8->trunk diff -r c56a29d4346d -r bffce780999d plugins/mod_storage_sql.lua --- a/plugins/mod_storage_sql.lua Sat Feb 26 00:24:23 2011 +0000 +++ b/plugins/mod_storage_sql.lua Tue Mar 01 06:14:03 2011 +0000 @@ -96,7 +96,18 @@ end do -- process options to get a db connection - DBI = require "DBI"; + local ok; + prosody.unlock_globals(); + ok, DBI = pcall(require, "DBI"); + if not ok then + package.loaded["DBI"] = {}; + module:log("error", "Failed to load the LuaDBI library for accessing SQL databases: %s", DBI); + module:log("error", "More information on installing LuaDBI can be found at http://prosody.im/doc/depends#luadbi"); + end + prosody.lock_globals(); + if not ok or not DBI.Connect then + return; -- Halt loading of this module + end params = params or { driver = "SQLite3" };