Jamy Posted June 4, 2012 Group: Members Topic Count: 23 Topics Per Day: 0.00 Content Count: 54 Reputation: 0 Joined: 02/14/12 Last Seen: September 6, 2013 Share Posted June 4, 2012 How do I get the inactive accounts more than 1 year are deleted automatically. Quote Link to comment Share on other sites More sharing options...
Cookie Posted June 28, 2012 Group: Members Topic Count: 20 Topics Per Day: 0.00 Content Count: 213 Reputation: 109 Joined: 05/21/12 Last Seen: December 27, 2014 Share Posted June 28, 2012 (edited) Use at your own risk: # Delete cart storage DELETE FROM `cart_inventory` WHERE EXISTS ( SELECT `char`.`char_id` FROM `char` RIGHT JOIN `login` ON `login`.`account_id` = `char`.`account_id` WHERE `cart_inventory`.`char_id` = `char`.`char_id` AND `login`.`lastlogin` < DATE_ADD(CURDATE(), INTERVAL -1 YEAR)); # Delete storage DELETE FROM `storage` WHERE EXISTS ( SELECT `login`.`account_id` FROM `login` WHERE `storage`.`account_id` = `login`.`account_id` AND `login`.`lastlogin` < DATE_ADD(CURDATE(), INTERVAL -1 YEAR)); # Delete inventories DELETE FROM `inventory` WHERE EXISTS ( SELECT `char`.`char_id` FROM `char` RIGHT JOIN `login` ON `login`.`account_id` = `char`.`account_id` WHERE `inventory`.char_id = `char`.`account_id` AND `login`.`lastlogin` < DATE_ADD(CURDATE(), INTERVAL -1 YEAR)); # Delete characters DELETE FROM `char` WHERE EXISTS ( SELECT `login`.`account_id` FROM `login` WHERE `login`.account_id = `char`.`account_id` AND `login`.`lastlogin` < DATE_ADD(CURDATE(), INTERVAL -1 YEAR)); # Delete accounts DELETE FROM `login` WHERE `lastlogin` < DATE_ADD(CURDATE(), INTERVAL -1 YEAR); I wrote these queries up. Use at your own risk. Probably could do skills, variables and other junk, too. Let me know. Edit: Set-up a cronjob if using linux daily. Have it execute queries via mysql. Being admin that has hundreds of players online, I wouldn't suggest this at all unless the server is completely offline. That's just me - this could cause serious latency and issues. Let's say, for example, the player logs in while it's running... Yikes, lol. Edited June 28, 2012 by Cookie Quote Link to comment Share on other sites More sharing options...
Jamy Posted July 19, 2012 Group: Members Topic Count: 23 Topics Per Day: 0.00 Content Count: 54 Reputation: 0 Joined: 02/14/12 Last Seen: September 6, 2013 Author Share Posted July 19, 2012 Thanks Cookie, it worked. Quote Link to comment Share on other sites More sharing options...
Question
Jamy
How do I get the inactive accounts more than 1 year are deleted automatically.
Link to comment
Share on other sites
2 answers to this question
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.