• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

DB Cleaner error

tatiana

Sexy Girl
Joined
Mar 30, 2009
Messages
215
Reaction score
8
mysql_real_query(): DELETE FROM accounts WHERE accounts.id NOT IN(19,21,84,47,52,1,1,1,1,1,1,12,18,23,25,45,45,32,62,69,69,50,83,74,78,28,28,28,28,42,37,44,82,59,24,57,40,36,35,14,14,26,51,76,34,39,49,49,29,29,60,73,75,16,15,17,13,85,80,61,56,54,33,72,43,68,79,70,58,46,63,64,65,20,67,66,22,41,30,55,31,81,48); - MYSQL ERROR: The user specified as a definer ('root'@'localhost') does not exist (1449)

LUA:
--[[ Advanced Auto-DB Clean By >>Doggynub<< ]]--
--[[ tiny little part from : Automated Database Cleanup 1.1 //By Cybermaster ]]--
-- [[ credits for a better loop through database get result to :SpiderOt ]] --
local c = {
                    accounts = true ,              -- delete accounts that doenst contain players(same as deleting acc after the time down, as on deleting players that been inactive account will be emty so account will be deleted)
                    players = true,             -- delete players who are inactive?(this must be enabled)
                    time = 45,                     -- in days
                    remove_all = true,             -- remove all players data from data baase whe he is deleted? 
                    log_File = true,                -- make a log file state amount of player cleaned in every clean with their names?
                    print_console = true -- print amount of player and accounts deleted on each start up
                }
local players = {}
local names = {}
function cleanPlayers()
local Info = db.getResult("SELECT players.id AS id , players.name AS name FROM players WHERE  players.name NOT IN ('Account Manager','Druid Sample','Knight Sample','Paladin Sample','Sorcerer Sample') AND group_id < 2 AND lastlogin > 0 AND lastlogin < UNIX_TIMESTAMP() - '".. (c.time*24*60*60) .."' ;")
        if (Info:getID() ~= -1) then
            while true do
            table.insert(players, Info:getDataInt("id"))
            table.insert(names, Info:getDataString("name"))
            if not Info:next() then
                break
            end
        end
        Info:free()
        end 
        if #players > 0 then
            db.executeQuery("DELETE FROM players WHERE players.id IN ("..table.concat(players,",")..") ;")
            if c.remove_all == true then
                db.executeQuery("DELETE FROM player_skills WHERE player_id IN ("..table.concat(players,",")..") ;")
                db.executeQuery("DELETE FROM player_items WHERE player_id IN ("..table.concat(players,",")..") ;")
                db.executeQuery("DELETE FROM  player_depotitems WHERE player_id IN ("..table.concat(players,",")..") ;")
                db.executeQuery("DELETE FROM  player_deaths WHERE player_id IN ("..table.concat(players,",")..") ;")
                db.executeQuery("DELETE FROM  player_storage WHERE  player_id IN ("..table.concat(players,",")..") ;")
                db.executeQuery("DELETE FROM  player_killers WHERE  player_id IN ("..table.concat(players,",")..") ;")
                db.executeQuery("DELETE FROM  player_namelocks WHERE  player_id IN ("..table.concat(players,",")..") ;")
                db.executeQuery("DELETE FROM  player_spells WHERE  player_id IN ("..table.concat(players,",")..") ;")
                db.executeQuery("DELETE FROM  player_viplist WHERE  player_id IN ("..table.concat(players,",")..") ;")
            end
            if c.print_console == true then
                print(">> [DB] : "..#players.." players have been removed for not loggin for long time.")
            end
            if c.log_File == true then
                doWriteLogFile("data/logs/Database clean.txt"," : "..#players.." players cleaned --> (".. table.concat(names,", ")..") \n\n ")
            end
        end
end
local accounts = {}
function cleanDBAcc()
    function getDB()
        local result = db.getResult("SELECT COUNT(`id`) as `count` FROM `accounts`;")
        local tmp = result:getDataInt("count")
        result:free()
        return tmp
    end
    local before = getDB()
    local Info = db.getResult("SELECT accounts.id AS `id` FROM accounts INNER JOIN players ON accounts.id = players.account_id ;")
        if (Info:getID() ~= -1) then
            while true do
            table.insert(accounts, Info:getDataInt("id"))
            if not Info:next() then
                break
            end
        end
        Info:free()
        end 
        db.executeQuery("DELETE FROM accounts WHERE accounts.id NOT IN("..table.concat(accounts,",")..");")
        local new = before - getDB()
        if c.print_console == true then
            if new > 0 then
                if c.print_console == true then
                    print("\n>>>>[DB] : "..new.." Accounts were deleted\n")
                end
                if c.log_File == true then
                    doWriteLogFile("data/logs/Database clean.txt"," : "..new.." accounts cleaned \n\n ")
                end
            end
        end
    return true
end 
function onStartup()
    cleanPlayers()
    if c.accounts == true then
        cleanDBAcc()
    end
    return true
end
 
Back
Top