Merge branch 'develop/1.1.1' into develop/1.2.0

# Conflicts:
#	luamods/wolfadmin/db/db.lua
#	luamods/wolfadmin/main.lua
#	luamods/wolfadmin/util/files.lua
#	luamods/wolfadmin/util/tables.lua
#	luascripts/admin/admin.lua
#	luascripts/commands/admin/listlevels.lua
#	luascripts/commands/admin/showwarns.lua
#	luascripts/db/mysql.lua
#	luascripts/db/sqlite3.lua
This commit is contained in:
Timo Smit 2017-03-17 15:32:03 +01:00
commit cfd494a5e0
3 changed files with 18 additions and 12 deletions

View file

@ -22,21 +22,27 @@ local db = {}
local con local con
function db.isconnected()
return (con ~= nil)
end
-- as this module serves as a wrapper/super class, we load the selected database -- as this module serves as a wrapper/super class, we load the selected database
-- system in this function. might have to think of a better way to implement -- system in this function. might have to think of a better way to implement
-- this, but it will suffice. -- this, but it will suffice.
function db.oninit() function db.oninit()
if settings.get("db_type") == "mysql" then if settings.get("db_type") ~= "none" then
con = require (wolfa_getLuaPath()..".db.mysql") if settings.get("db_type") == "sqlite3" then
elseif settings.get("db_type") == "sqlite3" then con = require (wolfa_getLuaPath()..".db.sqlite3")
con = require (wolfa_getLuaPath()..".db.sqlite3") elseif settings.get("db_type") == "mysql" then
else con = require (wolfa_getLuaPath()..".db.mysql")
error("invalid database system (choose mysql, sqlite3)") else
error("invalid database system (none|sqlite3|mysql)")
end
setmetatable(db, {__index = con})
db.start()
end end
setmetatable(db, {__index = con})
db.start()
end end
events.handle("onGameInit", db.oninit) events.handle("onGameInit", db.oninit)

View file

@ -68,7 +68,7 @@ function files.loadFromCFG(fileName, idExpr)
table.insert(array[id], data) table.insert(array[id], data)
end end
return arrayCount, array return arrayCount, array
end end
@ -100,7 +100,7 @@ function files.saveToCFG(fileName, array)
end end
et.trap_FS_FCloseFile(fileDescriptor) et.trap_FS_FCloseFile(fileDescriptor)
return true return true
end end

View file