General > Developers Corner

uTime Cleanup

(1/1)

kmiller:
Hello.

Are there any simple scripts that clear people's data if they haven't joined in the last year or so? This would be very useful because my sv.db is very full and it could do with a good clean up.

MrPresident:

--- Code: ---sql.Query( "DELETE FROM utime WHERE lastvisit < " .. os.time() - 365*24*60*30 )

--- End code ---


Doesn't get much more simple that that. :)


You can just run that on your server with lua_run from your server console if you want, or make it into some kind of addon.

MrPresident:
If you are curious how many people are in that window.. you can run this in your server console and it'll output how many people in your console.

--- Code: ---lua_run print( #sql.Query( "SELECT * FROM utime WHERE lastvisit < " .. os.time() - 365*24*60*30) or {"NONE"} )
--- End code ---

kmiller:
Perfect. Thank you!

Navigation

[0] Message Index

Go to full version