yuriorlov Posted March 11, 2008 Posted March 11, 2008 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. Quote
iseeyou94056 Posted March 11, 2008 Posted March 11, 2008 Re: Clean up cron great this is useful Quote
AlabamaHit Posted March 11, 2008 Posted March 11, 2008 Re: Clean up cron Just curious.....not asking to convert nothing, lol. I can handle that...Just wonderin if I put those querys in my day cron page on my v2 if it would work? Quote
SpyderMonkey Posted March 11, 2008 Posted March 11, 2008 Re: Clean up cron They should work, AlabamaHit. just change mysql_query to $db->query, although my crons seem to run fine using mysql or $db Quote
AlabamaHit Posted March 12, 2008 Posted March 12, 2008 Re: Clean up cron cool thanks i was just nervous about the end of the query mail_time < (unix_timestamp() -2592000 was wonderin if that was only on v1..Thanks again Quote
Godhand Posted March 12, 2008 Posted March 12, 2008 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.) Quote
_stoner_ Posted March 13, 2008 Posted March 13, 2008 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... Quote
Cyanide Posted March 22, 2008 Posted March 22, 2008 Re: Clean up cron Very nice, I'm def using this. Thanks for posting. Quote
Yuri_orlov Posted April 12, 2008 Posted April 12, 2008 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) Quote
Spudinski Posted April 12, 2008 Posted April 12, 2008 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. Quote
Halo Posted April 12, 2008 Posted April 12, 2008 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 Quote
Yuri_orlov Posted April 12, 2008 Posted April 12, 2008 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. Quote
chaoswar4u Posted May 27, 2008 Posted May 27, 2008 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 Quote
Yuri_orlov Posted August 27, 2008 Posted August 27, 2008 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.