Author Topic: uTime Cleanup  (Read 200 times)

0 Members and 1 Guest are viewing this topic.

Offline kmiller

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
uTime Cleanup
« on: March 30, 2020, 08:08:41 PM »
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.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2726
  • Karma: 427
    • |G4P| Gman4President
Re: uTime Cleanup
« Reply #1 on: March 31, 2020, 12:35:01 AM »
Code: [Select]
sql.Query( "DELETE FROM utime WHERE lastvisit < " .. os.time() - 365*24*60*30 )


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.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2726
  • Karma: 427
    • |G4P| Gman4President
Re: uTime Cleanup
« Reply #2 on: March 31, 2020, 12:36:28 AM »
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: [Select]
lua_run print( #sql.Query( "SELECT * FROM utime WHERE lastvisit < " .. os.time() - 365*24*60*30) or {"NONE"} )

Offline kmiller

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: uTime Cleanup
« Reply #3 on: March 31, 2020, 07:22:55 AM »
Perfect. Thank you!