Jump to content
MakeWebGames

Recommended Posts

Posted

A lot of people don't prune their db's properly from what I can tell, this is something I wrote for my game and I run it every night to keep things nice and tidy...

Features:

*Deletes events and mails older than 30 days

*Deletes logs older than 30 days

*Deletes forum posts older than 120 days (basically checks the last reply date)

*Deletes users that haven't logged in for 120 days and all related records to these users

Notes:

*Make sure you know your table structures, mine are kinda screwy since I started with v1 beta and have built extensively on it with a lot of custom stuff.

*I am not responsible for you modifying this code and not checking your DB structure first

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Posted

Re: Clean up cron

this could be very useful.... could save quite a few people a lot of time if we set something like this up automatically.

My opinion of running it each day- it would drag the database on more then it is worth "daily" maybe set up a custom cron every 28 days or something. (it would be pointless for deleting attack logs and such daily unless you have massive amounts of attacking each day.)

Posted

Re: Clean up cron

 

A lot of people don't prune their db's properly from what I can tell, this is something I wrote for my game and I run it every night to keep things nice and tidy...

Features:

*Deletes events and mails older than 30 days

*Deletes logs older than 30 days

*Deletes forum posts older than 120 days (basically checks the last reply date)

*Deletes users that haven't logged in for 120 days and all related records to these users

Notes:

*Make sure you know your table structures, mine are kinda screwy since I started with v1 beta and have built extensively on it with a lot of custom stuff.

*I am not responsible for you modifying this code and not checking your DB structure first

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Very good mod +1 I was wondering when someone was gonna post something like this for FREE :) It's like music to my ears...

  • 2 weeks later...
  • 3 weeks later...
Posted

Re: Clean up cron

 

this could be very useful.... could save quite a few people a lot of time if we set something like this up automatically.

My opinion of running it each day- it would drag the database on more then it is worth "daily" maybe set up a custom cron every 28 days or something. (it would be pointless for deleting attack logs and such daily unless you have massive amounts of attacking each day.)

it depends on the size of your game, but because most of the queries are delete queries it should actually be pretty efficient if run regularly...I think mine processes in almost a second...

I am planning on adding to it a bit, to include a table optimize thing (because if you only run it a month it can create a lot of overhead after its done clearing)

Posted

Re: Clean up cron

It is never a good idea to delete content, especially users and forum posts.

You could rather send the users an email, and tell them that their account indeed still exists.

Also, removing unimportant logs is fine, but other types of logs such as access logs, is not a very god idea.

But for this purpose, a game, it is fine, but I would like to suggest keeping logs for a longer period than 30 days, you might find it very useful to have older logs.

Posted

Re: Clean up cron

 

It is never a good idea to delete content, especially users and forum posts.

You could rather send the users an email, and tell them that their account indeed still exists.

Also, removing unimportant logs is fine, but other types of logs such as access logs, is not a very god idea.

But for this purpose, a game, it is fine, but I would like to suggest keeping logs for a longer period than 30 days, you might find it very useful to have older logs.

 

I agree with Spudinski, what if user went on a long relaxing holiday and came back to see their account was deleted lol, not very nice, but a good mod for overcrowded games

Posted

Re: Clean up cron

its either 90 or 120 days...I don't know many people that go on vacation for that long...but feel free to change the time or put in a level < 5 or another check...

the formula is 86400 X number of days

as to logs, we are building a in foul able multi catcher (where the multi purpose is helping the other multis out) so logging more than 30 days in the transfer logs is pointless to us...the multi catching logs aren't touched.

  • 1 month later...
Posted

Re: Clean up cron

Is there ways to make a users counter change to this cron. For example if a mail was removed from say user 2020. The cron will delete it but that user in V2 will still show 1 mail. They will click it to find none. Is there a way to set this so if a mail is deleted and takes it of a users counter if found not to have been read of deleted. I think that made sence some how lol :p

  • 3 months later...
Posted

Re: Clean up cron

 

Is there ways to make a users counter change to this cron. For example if a mail was removed from say user 2020. The cron will delete it but that user in V2 will still show 1 mail. They will click it to find none. Is there a way to set this so if a mail is deleted and takes it of a users counter if found not to have been read of deleted. I think that made sence some how lol :p

I started with v1 beta so I have no idea how the mail system is in 2, but I would figure you could do a query that checks to see if there is 0 mails then put the counter to 0....maybe someone with v2 can explain what he is talking about

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...