Software / code / prosody
Comparison
plugins/mod_storage_sql1.lua @ 7361:3409773ca19a
Merge with Link Mauve
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 17 Apr 2016 22:28:48 +0200 |
| parent | 7359:a5a080c12c96 |
comparison
equal
deleted
inserted
replaced
| 7360:7a37fade5380 | 7361:3409773ca19a |
|---|---|
| 128 local commit_ok = connection:commit(); | 128 local commit_ok = connection:commit(); |
| 129 if ok and commit_ok then | 129 if ok and commit_ok then |
| 130 module:log("info", "Database table automatically upgraded"); | 130 module:log("info", "Database table automatically upgraded"); |
| 131 else | 131 else |
| 132 module:log("error", "Failed to upgrade database schema (%s), please see " | 132 module:log("error", "Failed to upgrade database schema (%s), please see " |
| 133 .."http://prosody.im/doc/mysql for help", | 133 .."https://prosody.im/doc/mysql for help", |
| 134 err or "unknown error"); | 134 err or "unknown error"); |
| 135 end | 135 end |
| 136 end | 136 end |
| 137 repeat until not stmt:fetch(); | 137 repeat until not stmt:fetch(); |
| 138 end | 138 end |
| 139 end | 139 end |
| 140 elseif params.driver ~= "SQLite3" then -- SQLite normally fails to prepare for existing table | 140 elseif params.driver ~= "SQLite3" then -- SQLite normally fails to prepare for existing table |
| 141 module:log("warn", "Prosody was not able to automatically check/create the database table (%s), " | 141 module:log("warn", "Prosody was not able to automatically check/create the database table (%s), " |
| 142 .."see http://prosody.im/doc/modules/mod_storage_sql#table_management for help.", | 142 .."see https://prosody.im/doc/modules/mod_storage_sql#table_management for help.", |
| 143 err or "unknown error"); | 143 err or "unknown error"); |
| 144 end | 144 end |
| 145 end | 145 end |
| 146 | 146 |
| 147 do -- process options to get a db connection | 147 do -- process options to get a db connection |
| 149 prosody.unlock_globals(); | 149 prosody.unlock_globals(); |
| 150 ok, DBI = pcall(require, "DBI"); | 150 ok, DBI = pcall(require, "DBI"); |
| 151 if not ok then | 151 if not ok then |
| 152 package.loaded["DBI"] = {}; | 152 package.loaded["DBI"] = {}; |
| 153 module:log("error", "Failed to load the LuaDBI library for accessing SQL databases: %s", DBI); | 153 module:log("error", "Failed to load the LuaDBI library for accessing SQL databases: %s", DBI); |
| 154 module:log("error", "More information on installing LuaDBI can be found at http://prosody.im/doc/depends#luadbi"); | 154 module:log("error", "More information on installing LuaDBI can be found at https://prosody.im/doc/depends#luadbi"); |
| 155 end | 155 end |
| 156 prosody.lock_globals(); | 156 prosody.lock_globals(); |
| 157 if not ok or not DBI.Connect then | 157 if not ok or not DBI.Connect then |
| 158 return; -- Halt loading of this module | 158 return; -- Halt loading of this module |
| 159 end | 159 end |