aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Martinez <kaeza@users.sf.net>2014-05-20 00:09:23 -0300
committerDiego Martinez <kaeza@users.sf.net>2014-05-20 00:10:55 -0300
commit2b51822b3e04c8cad168034cfbdb176cb4f3ec00 (patch)
tree0665dfe68689ead4a8efc552b3f57612b8209614
parent7409fd1be82489be021355b1e16e51174619652b (diff)
downloadxban2-2b51822b3e04c8cad168034cfbdb176cb4f3ec00.tar.gz
xban2-2b51822b3e04c8cad168034cfbdb176cb4f3ec00.tar.bz2
xban2-2b51822b3e04c8cad168034cfbdb176cb4f3ec00.zip
Remove DB backup.
Haters gonna hate.
-rw-r--r--init.lua5
-rw-r--r--shutil.lua42
2 files changed, 0 insertions, 47 deletions
diff --git a/init.lua b/init.lua
index ef6143e..869d079 100644
--- a/init.lua
+++ b/init.lua
@@ -4,7 +4,6 @@ xban = { }
local MP = minetest.get_modpath(minetest.get_current_modname())
dofile(MP.."/serialize.lua")
-dofile(MP.."/shutil.lua")
local db = { }
local tempbans = { }
@@ -261,10 +260,6 @@ local function load_db()
end
end
--- Backup database
-shutil.copy_file(DB_FILENAME,
- DB_FILENAME.."."..os.date("%Y%m%d%H%M%S"))
-
minetest.register_on_shutdown(save_db)
minetest.after(SAVE_INTERVAL, save_db)
load_db()
diff --git a/shutil.lua b/shutil.lua
deleted file mode 100644
index e8ca269..0000000
--- a/shutil.lua
+++ /dev/null
@@ -1,42 +0,0 @@
-
-shutil = { }
-
-function shutil.copy_file(src, dst)
- local e, sf, df, cont, ok
- sf, e = io.open(src, "rb")
- if not sf then
- return nil, "Error opening input: "..(e or "")
- end
- df, e = io.open(dst, "wb")
- if not df then
- sf:close()
- return nil, "Error opening output: "..(e or "")
- end
- cont, e = sf:read("*a")
- if not cont then
- sf:close()
- df:close()
- return nil, "Error reading input: "..(e or "")
- end
- ok, e = df:write(cont)
- if not ok then
- sf:close()
- df:close()
- return nil, "Error writing output: "..(e or "")
- end
- sf:close()
- df:close()
- return true
-end
-
-function shutil.move_file(src, dst)
- local ok, e = shutil.copy_file(src, dst)
- if not ok then
- return nil, "Copy failed: "..(e or "")
- end
- ok, e = os.remove(src)
- if not ok then
- return nil, "Remove failed: "..(e or "")
- end
- return true
-end