7 Commits

Author SHA1 Message Date
fa14efa9e2 Merge branch 'nalc-1.2' 2019-10-12 12:18:21 +02:00
Thomas Rudin
e937f5ff67 Add /xban_cleanup command to purge unbanned entries (#20)
Add documentation for /xban_cleanup
2019-06-06 18:54:46 +02:00
43acd1c620 Merge branch 'master' into nalc-1.2 2019-05-10 02:25:27 +02:00
sys4-fr
58e77ad16c Ajoute message de chargement du mod dans le journal "action" 2019-01-19 20:40:01 +01:00
sys4-fr
af26ae75bd Merge branch 'master' into nalc 2019-01-19 20:34:30 +01:00
Dorian Wouters
8fde3c240f Fix error when using an auth handler not providing enumerate_auths 2016-08-25 23:11:49 +02:00
Dorian Wouters
d200b342e9 Use auth_handler's enumerate_auths (not auth_table) if available 2016-08-23 01:36:57 +02:00
2 changed files with 33 additions and 0 deletions

View File

@@ -104,3 +104,9 @@ the supported import plugins at the time of writing:
* `v2`: Old format used by xban (`players.iplist.v2`).
**Example:** `/xban_dbi minetest`
### `xban_cleanup`
Removes all non-banned entries from the xban db.
**Usage:** `/xban_cleanup`

View File

@@ -314,6 +314,7 @@ minetest.register_chatcommand("xban_wl", {
end,
})
local function check_temp_bans()
minetest.after(60, check_temp_bans)
local to_rm = { }
@@ -374,6 +375,30 @@ local function load_db()
end
end
minetest.register_chatcommand("xban_cleanup", {
description = "Removes all non-banned entries from the xban db",
privs = { server=true },
func = function(name, params)
local old_count = #db
local i = 1
while i <= #db do
if not db[i].banned then
-- not banned, remove from db
table.remove(db, i)
else
-- banned, hold entry back
i = i + 1
end
end
-- save immediately
save_db()
return true, "Removed " .. (old_count - #db) .. " entries, new db entry-count: " .. #db
end,
})
minetest.register_on_shutdown(save_db)
minetest.after(SAVE_INTERVAL, save_db)
load_db()
@@ -383,3 +408,5 @@ minetest.after(1, check_temp_bans)
dofile(xban.MP.."/dbimport.lua")
dofile(xban.MP.."/gui.lua")
minetest.log("action", "[xban2] loaded.")