Jamy Posted June 4, 2012 Posted June 4, 2012 How do I get the inactive accounts more than 1 year are deleted automatically. Quote
Cookie Posted June 28, 2012 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
Question
Jamy
How do I get the inactive accounts more than 1 year are deleted automatically.
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.